user2604391
user2604391

Reputation: 11

Linking an extra object file

I am using qmake to manage the build of a CUDA project. I'd like to use the separate compilation feature of CUDA 5.0, which means that the device code must be linked together before being linked to the rest of the code.

I've managed the intermediate linking step by adding this to my .pro file:

QMAKE_PRE_LINK = $$CUDA_DIR/bin/nvcc $$CUDA_GENCODE -dlink $(OBJECTS) -o dlink.o

This creates an extra object file called dlink.o, which should be added to the array of objects to be linked by g++, but I don't know how to accomplish this.

Peeking into the Makefile, I notice that the linker is passed an additional variable called OBJCOMP, but it is not defined and I can't find a way to access it through qmake.

Upvotes: 1

Views: 161

Answers (1)

Ashwin Nanjappa
Ashwin Nanjappa

Reputation: 78528

Add this line to your .pro file:

LIBS += dlink.o

Upvotes: 1

Related Questions