Yes, sadly, you are 100% correct. According to Apple, only the following models/years of iMac will work: 27 inch, late 2009, 27 inch mid 2010, and iMac Mid 20111 to Mid 2014 support Target Display mode. If it's not one of these models or it's an iMac with Retina display, then no. You might be able to try with a MiniDisplayPort Cable betwen the two, but it doesn't look good. and you also need High Sierra 10.13.6 or earlier, you can't use Target DisplayMode with later versions of macOS or with Boot Camp and Windows. for the MacBook Pro early 2015, it might work over USB-C, which would be supported bv thunderbolt 3 , but again, there's the OS "gotcha". I don't know what year your imac might be, though. If you go to the large apple icon at the top left of the imac's screen and then click on "About this Mac" it'll tell you. Otherwise some software/hardware addon like AirServer , which has a 30 day trial then it's $26. It's not much to go on, I'm sure you can do better than I did.....
john b