C preprocessor definitions not passed to resource compiler in pure CUDA project
C compiler definitions are added to the resource compiler here. But if a project only contains CUDA files, they are not added.
Given three files:
CMakeLists.txt
project(RCFlags CXX CUDA)
add_definitions( -DUNICODE -D_UNICODE -D_WINDOWS -DWIN64 -D_USE_MATH_DEFINES -DNOMINMAX -DVC_EXTRALEAN -DUSE_OPENMP )
add_executable(${PROJECT_NAME} vectorAdd.cu Resource.rc ) #dummy.cpp )
vectorAdd.cu
__global__ void vectorAdd(const float *A, const float *B, float *C, int numElements)
{
int i = blockDim.x * blockIdx.x + threadIdx.x;
if (i < numElements)
{
C[i] = A[i] + B[i];
}
}
int main()
{
return 1;
}
Resource.rc
DummyMenu MENU
{
POPUP "&DummyPopup"
{
MENUITEM "&Clear", 1
}
}
Generating a VS 2017 solution with cmake -G "Visual Studio 15 2017 Win64"
creates a .vcxproj which has a <ResourceCompile>
section without preprocessor definitions listed in CMakeLists.txt.
But if you change CMakeLists.txt to include an empty dummy.cpp as well, then they are added.