View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0014516CMake(No Category)public2013-10-28 10:312016-06-10 14:31
ReporterMathieu Malaterre 
Assigned ToKitware Robot 
PrioritynormalSeverityfeatureReproducibilityhave not tried
StatusclosedResolutionmoved 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0014516: Map LANGUAGE source file property to compiler language flag
DescriptionCMake seems to assumes that `gcc` calls the C compiler while `g++`
calls the C++ compiler. Well this is not entirely true:

$ cat foo.C
int bar() { return 42; }

$ gcc -o foo.o -c foo.C
$ nm foo.o
0000000000000000 T _Z3barv
                 U __gxx_personality_v0

Compared to:

$ gcc -x c -o foo.o -c foo.C
$ nm foo.o
0000000000000000 T bar

Which means that the following CMake code is not working (at least on
debian+gcc compiler because of implicit gcc behavior treating capital
C file extension):

$ cat CMakeLists.txt
project(t)
add_library(foo foo.C)
set_source_files_properties(foo.C PROPERTIES LANGUAGE C)
set_target_properties(foo PROPERTIES LINKER_LANGUAGE C)
TagsNo tags attached.
Attached Filespatch file icon bug728108.patch [^] (360 bytes) 2015-02-05 06:45 [Show Content]

 Relationships
related to 0015438closedKitware Robot project([...] C) for Objective-C 

  Notes
(0037919)
Mathieu Malaterre (developer)
2015-02-05 06:45

adding patch, thanks for consideration.
(0038290)
Brad King (manager)
2015-03-25 10:53

A similar issue has been raised here:

 nonstandard C++ source filename extension
 http://thread.gmane.org/gmane.comp.programming.tools.cmake.user/52028 [^]
(0038291)
Brad King (manager)
2015-03-25 10:55

Re 0014516:0037919: We should not depend on the user to keep the "-x c" flag in the cache entry. Instead the CMAKE_<LANG>_COMPILE_OBJECT rule variable should be updated to include the flag as needed for each compiler. Supporting this in general will require research to collect the proper flag for each compiler.
(0038292)
Mathieu Malaterre (developer)
2015-03-25 10:58

Just for later reference, fixing this bug will affect bug 0015438.

Indeed cmake rely on the gcc compiler to have correct behavior for obj-c and obj-c++ (proper linking). In other word, the patch suggest in 0015438:

add_executable(foo foo.c foo.m)
set_source_files_properties(foo.m PROPERTIES LANGUAGE C)

will not work once 0014516 is fixed IMHO.
(0042404)
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
2013-10-28 10:31 Mathieu Malaterre New Issue
2015-02-05 06:45 Mathieu Malaterre File Added: bug728108.patch
2015-02-05 06:45 Mathieu Malaterre Note Added: 0037919
2015-03-25 10:52 Brad King Severity minor => feature
2015-03-25 10:52 Brad King Summary set_source_files_properties( ... C) not working => Map LANGUAGE source file property to compiler language flag
2015-03-25 10:53 Brad King Note Added: 0038290
2015-03-25 10:55 Brad King Note Added: 0038291
2015-03-25 10:58 Mathieu Malaterre Note Added: 0038292
2015-03-25 11:00 Brad King Relationship added related to 0015438
2016-06-10 14:29 Kitware Robot Note Added: 0042404
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