[CMake] Incorrect object file name on cmake compilation

Andreas Mohr andi at lisas.de
Thu Sep 11 05:19:05 EDT 2014


On Thu, Sep 11, 2014 at 08:25:27AM +0000, Ravi Raman wrote:
>    Actually, in our project, the names of the object files matter because
>    these object files go as an input to a object file comparison tool that
>    compares object file names. So, there are 2 sets of object files, one
>    coming from cmake build and one from Visual Studio build.
> 
>    The set coming from cmake build was having this object file naming with
>    extension .cpp.obj.
> 
>    That was the reason for looking into this issue.

Ah, so that means we're talking about this issue having come up
due to expectations about object naming being somewhat "usual"
(as opposed to CMake-configured naming), of an *external tool*,
rather than
due to uneasiness/issues detected within the CMake workflow itself.

So, that means:
- CMake handling likely *is* consistent (at least in regard to this aspect)
- the external tool does not like it :)
- a manual specific compiler flag setting was configured
  to fall back to previously "usual" object naming

So, my thoughts on this are that it would be best to have the external tool
offer an option to support custom object file naming patterns,
since naming of internally generated object files
may easily differ in various build systems.

Manually adding a very specific /Fo option *can* be done, but:
- this manual tweak might then cause incompatibilities with internal CMake assumptions
  (quite possibly there are CMake configuration variables/mechanisms
   to generically switch this naming pattern though)
- it's extremely compiler-specific (read: not environment-generic)

So, I would recommend going the "improve external tool support" route instead
(or resort to figuring out CMake config mechanisms to generically
switch object naming).

Andreas Mohr


More information about the CMake mailing list