View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0015842CMakeCMakepublic2015-11-10 15:582016-06-10 14:31
Reporterveeg 
Assigned ToKitware Robot 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionmoved 
PlatformcygwinOSWindowsOS Version10
Product VersionCMake 3.3.2 
Target VersionFixed in Version 
Summary0015842: project() duplicate language / erroneous API usage results in incorrect file endings on object files.
DescriptionUsing 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 ReproduceSee 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 ...
...
..
..
..
TagsNo tags attached.
Attached Filestxt file icon CMakeLists.txt [^] (127 bytes) 2015-11-10 15:58 [Show Content]

 Relationships

  Notes
(0039861)
Brad King (manager)
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 (administrator)
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.

 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
2015-11-10 16:11 Brad King Note Added: 0039861
2016-06-10 14:29 Kitware Robot Note Added: 0042886
2016-06-10 14:29 Kitware Robot Status new => resolved
2016-06-10 14:29 Kitware Robot Resolution open => moved
2016-06-10 14:29 Kitware Robot Assigned To => Kitware Robot
2016-06-10 14:31 Kitware Robot Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team