[cmake-developers] [CMake 0015842]: project() duplicate language / erroneous API usage results in incorrect file endings on object files.

Mantis Bug Tracker mantis at public.kitware.com
Tue Nov 10 15:58:21 EST 2015


The following issue has been SUBMITTED. 
====================================================================== 
https://public.kitware.com/Bug/view.php?id=15842 
====================================================================== 
Reported By:                veeg
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   15842
Category:                   CMake
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2015-11-10 15:58 EST
Last Modified:              2015-11-10 15:58 EST
====================================================================== 
Summary:                    project() duplicate language / erroneous API usage
results in incorrect file endings on object files.
Description: 
Using the (arguably incorrect format) of the project() command:
  project (testproj C VERSION 1.0.0 LANGUAGES C)
is validated and passes Makefile generation. However, the output file extension
for object files results in *.c, and not *.c.o

Attached CMakeLists.txt produced the following object file path
  CMakeFiles/test_executable.dir/test.c

When attempted linked into an executable, the compiler thinks the inputfiles are
source files, not object files, due the file ending. Therefore, it spews out an
endless stream of "stray '\xxx' in program" (gcc does atleast). Not so user
friendly to detect what actually went wrong.

Steps to Reproduce: 
See attached CMakeLists.txt for MWE.

* Put attached CMakeLists.txt in empty folder
* issue CMake command to build makefiles:
** "cmake ."
* Build executable
** "make"

Output:
[ 50%] Linking C executable test_executable.exe
CMakeFiles/test_executable.dir/test.c:1:1: error stray `\206` in program ...
...
..
..
..

====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2015-11-10 15:58 veeg           New Issue                                    
2015-11-10 15:58 veeg           File Added: CMakeLists.txt                    
======================================================================



More information about the cmake-developers mailing list