[cmake-developers] [CMake 0014516]: set_source_files_properties( ... C) not working

Mantis Bug Tracker mantis at public.kitware.com
Mon Oct 28 10:31:09 EDT 2013


The following issue has been SUBMITTED. 
====================================================================== 
http://cmake.org/Bug/view.php?id=14516 
====================================================================== 
Reported By:                Mathieu Malaterre
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   14516
Category:                   (No Category)
Reproducibility:            have not tried
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2013-10-28 10:31 EDT
Last Modified:              2013-10-28 10:31 EDT
====================================================================== 
Summary:                    set_source_files_properties( ... C) not working
Description: 
CMake 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)

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

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2013-10-28 10:31 Mathieu MalaterreNew Issue                                    
======================================================================




More information about the cmake-developers mailing list