I am modifying a CMake file of an existing open source project written in C++ to try to link it to a SWIG Java interface file. The code I have pieced together from other forums and tinkering around is this :
FIND_PACKAGE(SWIG 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 mainwindow.i mainwindow_wrap.c)
SWIG_LINK_LIBRARIES(mainwindow ${JAVA_LIBRARIES})
Is there anything wrong with what I have written/found? When I run the cmake command, it builds. Yet when I run make -j3 (I need to do this to access the newly integrated libraries later on), it crashes, giving the very ambiguous error message “make: * [all] Error 2 “
Thanks!
I fixed my particular problem by adding the full path to the wrapper and interface files in the set source properties commands. To point it towards
jni.h, I addedFIND_PACKAGE(JNI REQUIRED)at the beginning.