View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0011563CMakeModulespublic2010-12-02 14:522011-03-28 12:10
ReporterMikael Lund 
Assigned ToMathieu Malaterre 
PrioritynormalSeveritytrivialReproducibilityalways
StatusclosedResolutionno change required 
PlatformmacOSdarwinOS Version10.6
Product VersionCMake 2.8.3 
Target VersionFixed in Version 
Summary0011563: ability to parse *.h files as *.i interface files
DescriptionRather than writing separate SWIG interface files (*.i), swig commands are often included directly in C/C++ header files. I.e.

/*---- test.h files -----*/
#ifdef SWIG
%module faunus
%{
#include "test.h"
%}

class someclass {
  ...
};
/*----- end of header file -----*/

The cmake UseSWIG module, however, allows only passing of *.i files (other file extentions are filtered out and not passed on to swig). I suggest to allow for *.h files as well. This can be done with a simple patch - see below. This should be fine as one would (as far as I can tell) not add header files for other reasons than this.
Additional Information$ diff UseSWIG.cmake UseSWIG.cmake.bak

197c197
< IF(${it} MATCHES ".*\\.(i|h)$")
---
> IF(${it} MATCHES ".*\\.i$")
199c199
< ELSE(${it} MATCHES ".*\\.(i|h)$")
---
> ELSE(${it} MATCHES ".*\\.i$")
201c201
< ENDIF(${it} MATCHES ".*\\.(i|h)$")
---
> ENDIF(${it} MATCHES ".*\\.i$")
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0023690)
Mathieu Malaterre (developer)
2010-12-03 07:27

Hi,

AFAIK your proposed patch will break backward compatibility.

Why not directly use:

SWIG_ADD_SOURCE_TO_MODULE(faunus output_generated_file_to_cleanup test.h)

just after the SWIG_ADD_MODULE.

Thx
(0024222)
Mikael Lund (reporter)
2010-12-16 17:44

Thanks. I've solved the issue by simply creating a single .i where I import all the .h files.
Best, Mikael

 Issue History
Date Modified Username Field Change
2010-12-02 14:52 Mikael Lund New Issue
2010-12-03 07:27 Mathieu Malaterre Note Added: 0023690
2010-12-15 12:23 David Cole Assigned To => Mathieu Malaterre
2010-12-15 12:23 David Cole Status new => assigned
2010-12-16 17:44 Mikael Lund Note Added: 0024222
2011-03-28 12:10 Mathieu Malaterre Status assigned => closed
2011-03-28 12:10 Mathieu Malaterre Resolution open => no change required


Copyright © 2000 - 2018 MantisBT Team