[CMake] Incorrect object file name on cmake compilation

Ravi Raman ravi.raman at Xoriant.Com
Thu Sep 11 03:49:23 EDT 2014


Hi,

Thanks Petr for your reply. By incorrect I meant instead of the conventional main.obj, we get main.cpp.obj.
I understood what you are saying. We have found a solution for this in our cmake code.
We have explicitly set the /Fo compiler flag for main.cpp. With that it creates main.obj for main.cpp and also main.res for main.rc

Thanks & Regards

Ravi Raman
Xoriant Solutions Pvt. Ltd
4th Floor, Winchester, Hiranandani Business Park, Powai, Mumbai 400076, INDIA.
Tel: +91 22 30511000,9930100026 Extn: 2144 Voip No. 4088344495/96/97/98 Voip Extn:1178| Fax: +91 22 30511111
ravi.raman at xoriant.com<mailto:ram.singh at xoriant.com>| http://www.xoriant.com<http://www.xoriant.com/>

From: Petr Kmoch [mailto:petr.kmoch at gmail.com]
Sent: Thursday, September 11, 2014 12:11 PM
To: Ravi Raman
Cc: cmake at cmake.org
Subject: Re: [CMake] Incorrect object file name on cmake compilation

Hi Ravi.

In what sense is the name "incorrect?" There is no correct/incorrect way to name object files in relation to the source file name; it can be arbitrary, as long as it's correctly passed on to the linker. I believe CMake chooses to append ".obj" to the whole file name if there is more than one file with the same base name. But why should this be a problem?

Petr

On Thu, Sep 11, 2014 at 7:59 AM, Ravi Raman <ravi.raman at xoriant.com<mailto:ravi.raman at xoriant.com>> wrote:
Hi,

We are working on a cmake project.

The issue is that the cmake build is successful but after the execution of cmake build step, the name of the object file is incorrect. On compilation of the source file main.cpp, the name of the object file is coming incorrectly as main.cpp.obj instead of main.obj

To simulate the problem, please find attached herewith a zip file that contains
CMakeLists.txt
main.cpp
main.rc
The source list contains “main.cpp” and the resource file “main.rc”

Please note the following:

1.       This problem occurs only when the resource file main.rc is present in the list.

2.       This problem does not occur when the resource file main.rc is excluded from the list OR if the resource file has a name other than main.rc

Thanks & Regards

Ravi Raman
Xoriant Solutions Pvt. Ltd
4th Floor, Winchester, Hiranandani Business Park, Powai, Mumbai 400076, INDIA.
Tel: +91 22 30511000<tel:%2B91%2022%2030511000>,9930100026 Extn: 2144 Voip No. 4088344495<tel:4088344495>/96/97/98 Voip Extn:1178| Fax: +91 22 30511111<tel:%2B91%2022%2030511111>
ravi.raman at xoriant.com<mailto:ram.singh at xoriant.com>| http://www.xoriant.com<http://www.xoriant.com/>


--

Powered by www.kitware.com<http://www.kitware.com>

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20140911/11f4f5e7/attachment-0001.html>


More information about the CMake mailing list