Hi all

Does anyone of you know how to reliably obtain the list of object files belonging to a target? And in the same line, how would I obtain the object file which corresponds to a certain source file (provided that it is only used for a single target)?

Using the approach shown in the CMake-Book (4th ed., p. 52) which simply replaces .cxx by .obj (obviously on Windows) does not work reliably, especially if the sources are not in CMAKE_CURRENT_SOURCE_DIR. On Windows (this is the case I'm interested in, regrettably), particularly with MSVC, additional problems arise if the same target has multiple files with the same file name in different directories. Because, by default, all object files seem to be built in ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}, EXCEPT if there are name clashes. In this case one of the objects gets built in $ {CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}, the others in subdirectories, in order to prevent the name clash.

So, you see, obtaining the object file name is anything but trivial. I scourged the documentation and Google, but couldn't find anything useful...


Thanks for your help in advance

Michael
_______________________________________________
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to