I'm trying to generate a java-c++ interface using swig. I use the
following function to generate java and C++ wrappers using swig:
#Generates a swig library.
function(compile_directory_to_swig DIRECTORY_PATH)
if(NOT SWIG_FOUND)
find_package(SWIG REQUIRED)
include(${SWIG_USE_FILE})
set(SWIG_CXX_EXTENSION "cpp")
set(CMAKE_SWIG_FLAGS "")
endif(NOT SWIG_FOUND)
file(GLOB CPP_FILES "${DIRECTORY_PATH}/*.cpp")
file(GLOB I_FILES "${DIRECTORY_PATH}/*.i")
foreach(I_FILE ${I_FILES})
set_source_files_properties(${I_FILE} PROPERTIES CPLUSPLUS ON)
set_source_files_properties(${I_FILE} PROPERTIES SWIG_FLAGS
"-includeall")
endforeach(I_FILE ${I_FILES})
get_filename_component(UNIT_NAME ${DIRECTORY_PATH} NAME)
SWIG_ADD_MODULE(${UNIT_NAME}_swig java ${I_FILES} ${CPP_FILES})
SWIG_LINK_LIBRARIES(${UNIT_NAME}_swig ${ARGN})
endfunction(compile_directory_to_swig DIRECTORY_PATH)
This lists all cpp files and I files in the directory, and calls swig.
However, this gives the following error:
make[2]: *** No rule to make target
`main/cpp/lib/ThreadedOgreVisualization/VisualizationJAVA_wrap.cpp',
needed by
`main/cpp/lib/CMakeFiles/ThreadedOgreVisualization_swig.dir/ThreadedOgre
Visualization/VisualizationJAVA_wrap.cpp.o'. Stop.
make[1]: ***
[main/cpp/lib/CMakeFiles/ThreadedOgreVisualization_swig.dir/all] Error 2
make: *** [all] Error 2
In the UseSWIG script, the cpp files that will be generated are
explicitly set to "generated" in line 161, so I guess that can't be the
problem
161: SET_SOURCE_FILES_PROPERTIES("${swig_generated_file_fullname}"
${swig_extra_generated_files} PROPERTIES GENERATED 1)
Any ideas on how to get this working?
I'm using cmake 2.6.2
Jonatan
-------------------------------------------------------------
This e-mail is intended exclusively for the addressee. If you
are not the addressee you must not read, copy, use or
disclose the e-mail nor the content; please notify us
immediately [by clicking 'Reply'] and delete this e-mail.
_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake