[PATCH] kconfig_compiler and C++ file extensions

Adriaan de Groot adridg at sci.kun.nl
Mon Jan 12 15:49:27 GMT 2004


Some nasty corner of kde-pim uses .cc as an extension for C++ files, while
kconfig_compiler produces .cpp files. This wouldn't be a problem, except
my auto* setup (autoconf 2.57, automake 1.7.5), when confronted with lists
of sources with .cc extensions, decides that the compiled name of the
.kcfg file will be .cc as well. And then the compilation fails, because
the kcfg output is in a .cpp file.

The attached patch adds one more configuration option to the kcfgrc file,
Suffix, so that you can specify the resulting suffix; it defaults to .cpp.

OK to commit, even at this late date?

-- 
 Adriaan de Groot    adridg at cs.kun.nl     Kamer A6020     024-3652272
GPG Key Fingerprint 934E 31AA 80A7 723F 54F9  50ED 76AC EE01 FEA2 A3FE
               http://www.cs.kun.nl/~adridg/research/

-------------- next part --------------
Index: README.dox
===================================================================
RCS file: /home/kde/kdelibs/kdecore/kconfig_compiler/README.dox,v
retrieving revision 1.4
diff -u -3 -p -r1.4 README.dox
--- README.dox	27 Dec 2003 18:25:39 -0000	1.4
+++ README.dox	12 Jan 2004 15:18:13 -0000
@@ -156,6 +156,13 @@ The following options are read from the 
   scope of the generated class. If set to false, each Enum item will get an own
   namespace for its choices.</td>
 </tr>
+<tr>
+  <td><b>Suffix</b></td>
+  <td>string</td>
+  <td>.cpp</td>
+  <td>Suffix for the generated C++ code. May need to be set for
+  projects that use .cc or .C for C++ code.</td>
+</tr>
 </table>
 
 
Index: kconfig_compiler.cpp
===================================================================
RCS file: /home/kde/kdelibs/kdecore/kconfig_compiler/kconfig_compiler.cpp,v
retrieving revision 1.35
diff -u -3 -p -r1.35 kconfig_compiler.cpp
--- kconfig_compiler.cpp	11 Nov 2003 19:54:40 -0000	1.35
+++ kconfig_compiler.cpp	12 Jan 2004 15:18:14 -0000
@@ -745,6 +745,7 @@ int main( int argc, char **argv )
      allMutators = true;
   itemAccessors = codegenConfig.readBoolEntry( "ItemAccessors", false );
   bool setUserTexts = codegenConfig.readBoolEntry( "SetUserTexts", false );
+  QString cxxSuffix = codegenConfig.readEntry( "Suffix", ".cpp" );
 
   globalEnums = codegenConfig.readBoolEntry( "GlobalEnums", false );
 
@@ -852,7 +853,7 @@ int main( int argc, char **argv )
 #endif
 
   QString headerFileName = baseName + ".h";
-  QString implementationFileName = baseName + ".cpp";
+  QString implementationFileName = baseName + cxxSuffix ;
 
   QFile header( baseDir + headerFileName );
   if ( !header.open( IO_WriteOnly ) ) {


More information about the kde-core-devel mailing list