I've got a makefile (a file called 'Makefile' which is run by cmake I believe), and most of the 'sample' ones I can see are just one line (and the rest appear to be stuff I don't 'yet' understand and then this same one line.

include $(shell rospack find mk)/cmake.mk

(in the terminal rospack find [package] returns the path to said package, and cmake.mk is obviously the file it wants to include)

my problem is, that this appears (to me at least) to be written for use in a linux system (which basically the entirety of ros, the program I'm'm working with, was) and in windows this appears to just try to be

include /cmake.mk

(which unsurprisingly doesn't work)

basically I need to know how to do the same thing in windows, generally in a 'dynamic' way, as it will only cause more problems down the line if i get this working by hard-coding the directory path and then it breaks because its not set properly some time in the future)

Ok, so I'm a little out of my depth here... but I really need to get something working as is asap, so that I've got a bit of leeway to learn more over my week off for Christmas.

so I guess if this isn't possible/ is particularly hard, a way of hard coding it would be a stopgap

I tried

include C:\[directory]\cmake.mk

but it seems to have issues with the ':'


First, verify that simply saying rospack find mk at the terminal prompt works; you may need to first adjust your %PATH%.

Then, let's replace this include line with something that uses cmake's cross-platform executable support:

execute_process(COMMAND ${CMAKE_COMMAND} -E rospack find mk OUTPUT_VARIABLE ROSMKDIR)
include ${ROSMKDIR}/cmake.mk

(Hat tip to this answer I found on stackoverflow)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.