MantisBT - CMake
View Issue Details
0014040CMakeModulespublic2013-03-25 16:242013-10-07 10:04
Javier 
 
normalmajoralways
closedno change required 
linuxred hat2.3
CMake 2.8.10.2 
 
0014040: SWIG doesn't support -pacakge
I'm trying to generate java wrappers for a C++ interface. I need the wrappers to be in a specific package. This is achieved by passing -package <package> to swig.

When I set SWIG_FLAGS to "-package com.something", swigs yields "Unrecognized option -package com.something"

The reason for this is that in build.cmake, the space is escaped:

...
&& /usr/local/bin/swig -java -package\ com.something ...
 
find_package(JNI REQUIRED)
find_package(SWIG REQUIRED)

include(${SWIG_USE_FILE})
include_directories(${JNI_INCLUDE_DIRS})

set_source_files_properties(example.i PROPERTIES CPLUSPLUS ON)
set_source_files_properties(example.i PROPERTIES SWIG_FLAGS "-package com.something")

swig_add_module(example java example.i example.cpp)
No tags attached.
Issue History
2013-03-25 16:24JavierNew Issue
2013-03-25 16:34Brad KingNote Added: 0032699
2013-03-26 08:26JavierNote Added: 0032701
2013-03-26 08:31Brad KingStatusnew => resolved
2013-03-26 08:31Brad KingResolutionopen => no change required
2013-10-07 10:04Robert MaynardNote Added: 0034016
2013-10-07 10:04Robert MaynardStatusresolved => closed

Notes
(0032699)
Brad King   
2013-03-25 16:34   
You're quoting the flags in the CMake source so it thinks you want one flag with a space. Try this instead:

 set_property(SOURCE example.i PROPERTY CPLUSPLUS ON)
 set_property(SOURCE example.i PROPERTY SWIG_FLAGS -package com.something)

or

 set_source_files_properties(example.i PROPERTIES
   CPLUSPLUS ON
   SWIG_FLAGS "-package;com.something" # ;-list of flags
   )
(0032701)
Javier   
2013-03-26 08:26   
Thanks Brad, this worked just fine. I think we can close this issue as invalid.
(0034016)
Robert Maynard   
2013-10-07 10:04   
Closing resolved issues that have not been updated in more than 4 months.