[cmake-developers] [CMake 0016031]: FindCUDA.cmake - CUDA_SEPARABLE_COMPILATION fails because of escape character

Mantis Bug Tracker mantis at public.kitware.com
Tue Mar 22 13:09:54 EDT 2016


The following issue has been SUBMITTED. 
====================================================================== 
https://cmake.org/Bug/view.php?id=16031 
====================================================================== 
Reported By:                Thibault Notargiacomo
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   16031
Category:                   CMake
Reproducibility:            always
Severity:                   major
Priority:                   high
Status:                     new
====================================================================== 
Date Submitted:             2016-03-22 13:09 EDT
Last Modified:              2016-03-22 13:09 EDT
====================================================================== 
Summary:                    FindCUDA.cmake - CUDA_SEPARABLE_COMPILATION fails
because of escape character
Description: 
When using
set( CUDA_SEPARABLE_COMPILATION ON )
in cunjunction with
find_package(CUDA 7.5 REQUIRED)

I get a problem in the make command generated for the link with the intermediate
object file, especially, the "-ccbin" option that should give to the cuda
command line the $CXX variable (in my case).




Steps to Reproduce: 
Try to setup in a directory the following files:

===================================================
test.cu:
#include "test.cu.h"
#include "thrust/device_vector.h"

void A::doIt()
{
	thrust::device_vector<float> a(10,10);
	std::cout <<"A = "<<a[0]<<std::endl;
}

===================================================
test.cu.h:
#include <iostream>

class A
{
public:
	A()=default;
	virtual ~A()=default;
	virtual void doIt();
private:
	int m_a;
};
===================================================
main.cpp:
#include <cstdlib>
#include "test.cu.h"

int main(int argc, char* argv[])
{
	A a;
	a.doIt();
	return EXIT_SUCCESS;
}

===================================================
CMakeLists.txt:
cmake_minimum_required (VERSION 3.5)

ADD_DEFINITIONS( ${CMAKE_CXX_FLAGS} "-std=c++11" )
find_package(CUDA 7.5 REQUIRED)
set( CUDA_SEPARABLE_COMPILATION ON )
cuda_add_executable( testit test.cu main.cpp )

Additional Information: 
Extract of the build.make file that I had to modify in order to bypass the
problem temporarily:

CMakeFiles/testit.dir/testit_intermediate_link.o:
CMakeFiles/testit.dir/testit_generated_test.cu.o
	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --blue --bold
--progress-dir=/home/technic105/Documents/test/cmake35Bug/CMakeFiles
--progress-num=$(CMAKE_PROGRESS_2) "Building NVCC intermediate link file
CMakeFiles/testit.dir/testit_intermediate_link.o"
	/usr/local/cuda/bin/nvcc -m64 -ccbin \"/opt/rh/devtoolset-2/root/usr/bin/gcc\"
-dlink
/home/technic105/Documents/test/cmake35Bug/CMakeFiles/testit.dir//./testit_generated_test.cu.o
-o
/home/technic105/Documents/test/cmake35Bug/CMakeFiles/testit.dir/./testit_intermediate_link.o


Notice the -ccbin \"/opt/rh/devtoolset-2/root/usr/bin/gcc\" that causes the
build to fail on my machine
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2016-03-22 13:09 Thibault NotargiacomoNew Issue                                 
  
======================================================================



More information about the cmake-developers mailing list