CMake and SWIG Integration

Hello,

I am working on embedding Avogadro into a Java Application. So far, I have
re-implemented a modified GUI of Avogadro using the .UI file in the source
and using QT Jambi JARs. I am in the process of linking the Java GUI to the
rest of the project, in a similar manner the normal mainwindow.ui is to the
mainwindow.cpp. To try to access mainwindow.cpp, and the rest of the
project, I am attempting to integrate SWIG with CMake. I have written a SWIG
Interface file that simply imports the mainwindow.h header. My reasoning
there is that SWIG should be then linked to the functions in mainwindow.cpp,
which (theoretically) should link the Java GUI to the rest of the project.
Naturally, one of the first steps in this process is to integrate SWIG
commands in the CMakeLists.txt file, as I have done :

#Java SWIG interface linking
FIND_PACKAGE(SWIG REQUIRED)
FIND_PACKAGE(JNI REQUIRED)
FIND_PACKAGE(Eigen2 REQUIRED)
INCLUDE(${SWIG_USE_FILE})
INCLUDE_DIRECTORIES(${JAVA_INCLUDE_PATH})
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/avogadro/src)
SET(CMAKE_SWIG_FLAGS "")
SET_SOURCE_FILES_PROPERTIES(mainwindow.i PROPERTIES CPLUSPLUS ON)
SET_SOURCE_FILES_PROPERTIES(mainwindow.i PROPERTIES SWIG_FLAGS

“-includeall”)
SWIG_ADD_MODULE(mainwindow java avogadro/src/mainwindow.i
avogadro/src/mainwindow_wrap.c)
SWIG_LINK_LIBRARIES(mainwindow ${JAVA_LIBRARIES})

The CMake command runs successfully, but when I try to run the make command,
it fails. When I run make with the parameter VERBOSE=1, it tells me that
Eigen cannot be found. I realize that Avogadro uses a specific CMake file to
find Eigen or any other library installed on the system. Just to be clear,
Avogadro can compile correctly without my tweaks, so I am missing nothing. I
copied the Eigen folder to the same directory, and the CMake make command
failed because of “cstdlib” was not found in an Eigen file. I don’t think
SWIG should be going that far, it should just be compiling the interface
file and merging it into the Avogadro libraries. Any thoughts on what I am
doing wrong? I realize this problem may not involve what most of you work
on, but since it is directly dealing with Avogadro, I thought it might be
helpful to ask.

Thank you,

Cecil O’Dell