MantisBT - CMake
View Issue Details
0015842CMakeCMakepublic2015-11-10 15:582016-06-10 14:31
veeg 
Kitware Robot 
normalminoralways
closedmoved 
cygwinWindows10
CMake 3.3.2 
 
0015842: project() duplicate language / erroneous API usage results in incorrect file endings on object files.
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.
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 ...
...
..
..
..
No tags attached.
txt CMakeLists.txt (127) 2015-11-10 15:58
https://public.kitware.com/Bug/file/5573/CMakeLists.txt
Issue History
2015-11-10 15:58veegNew Issue
2015-11-10 15:58veegFile Added: CMakeLists.txt
2015-11-10 16:11Brad KingNote Added: 0039861
2016-06-10 14:29Kitware RobotNote Added: 0042886
2016-06-10 14:29Kitware RobotStatusnew => resolved
2016-06-10 14:29Kitware RobotResolutionopen => moved
2016-06-10 14:29Kitware RobotAssigned To => Kitware Robot
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0039861)
Brad King   
2015-11-10 16:11   
It looks like cmGlobalGenerator::EnableLanguage assumes it is given a list of languages that does not repeat. It is a virtual function so fixing the list needs to be done by the callers. The callers are in Source/cmEnableLanguageCommand.cxx and Source/cmProjectCommand.cxx so one could look at fixing them or adding a helper wrapper for them to call.
(0042886)
Kitware Robot   
2016-06-10 14:29   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.