[CMake] Object files: .o vs .obj?

Phil Smith phil at voltage.com
Fri Oct 10 13:55:57 EDT 2008


I have no idea how to construct an example, I'm afraid, though I'm willing to try. But there's nothing in the project files that makes such a distinction as far as I can tell.

The compiler is the same - it's a cross-compiler, and is being invoked as a script, since it's a 2-pass deal (compiles to assembler, assemble that).

As far as I can tell, the obj file suffix is chosen by make - it invokes the compiler with -o filename.c.o[bj]. The CMake call generates the Makefiles, of course, which is why I assumed that it was CMake making this decision. The .obj do appear in the Makefiles, and not anywhere in CMakeLists.txt that I can see (other than in some 'make clean' stuff I added).

...phsiii

From: David Cole [mailto:david.cole at kitware.com]
Sent: Friday, October 10, 2008 1:02 PM
To: Phil Smith
Cc: CMake
Subject: Re: [CMake] Object files: .o vs .obj?

No, it doesn't make sense. Can you construct a minimal example that demonstrates this?

If not, there must be something in your project files that differentiates between in-source and out-of-source builds...?
Are you changing compilers based on in-source/out-of-source?

The in-source/out-of-source change should have no effect on the suffix used for object files. Isn't the obj file suffix typically chosen by the compiler...?


On Fri, Oct 10, 2008 at 12:50 PM, Phil Smith <phil at voltage.com<mailto:phil at voltage.com>> wrote:
Hm. If I do an out-of-source build, I get .o files.  If I do an in-source build, I get .obj.

(Yes, I know in-source builds are considered Evil; the lead engineer wants to do 'em that way, not sure why, so I was testing to see if they'd work, noticed that I was getting .obj files.)

Does this make any sense?

...phsiii
-----Original Message-----
From: cmake-bounces at cmake.org<mailto:cmake-bounces at cmake.org> [mailto:cmake-bounces at cmake.org<mailto:cmake-bounces at cmake.org>] On Behalf Of Phil Smith
Sent: Thursday, October 09, 2008 12:27 PM
To: CMake
Subject: [CMake] Object files: .o vs .obj?

With (allegedly) identical CMake setups, we have two machines that generate different outputs: .o vs. obj. The one that generates .obj has Visual Studio installed, the other doesn't.

I tried adding
       SET(CMAKE_C_OUTPUT_EXTENSION ".obj")
to my Toolchain file, but it made no difference.

The CMake invocation is:

cmake -DCMAKE_TOOLCHAIN_FILE:string="%DIGNUS_SOURCE%\zosport.cmake" -G"Unix Makefiles" %DIGNUS_SOURCE%\vtk-core\

I even added:
 message(STATUS "Generator is ${CMAKE_GENERATOR}")
in the ".obj" machine's CMakeLists.txt (that's the machine with Visual Studio installed), again, no difference.

I'd slightly rather force .obj than .o, but in any case, I need it to be predictable. Any ideas?
--
...phsiii

Phil Smith III
phil at voltage.com<mailto:phil at voltage.com>
Voltage Security, Inc.
www.voltage.com<http://www.voltage.com>
(703) 476-4511 (home office)
(703) 568-6662 (cell)

_______________________________________________
CMake mailing list
CMake at cmake.org<mailto:CMake at cmake.org>
http://www.cmake.org/mailman/listinfo/cmake
_______________________________________________
CMake mailing list
CMake at cmake.org<mailto:CMake at cmake.org>
http://www.cmake.org/mailman/listinfo/cmake

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20081010/67d27316/attachment-0001.htm>


More information about the CMake mailing list