diff --git a/Source/cmVTKWrapJavaCommand.cxx b/Source/cmVTKWrapJavaCommand.cxx index 7f9ff20ab..c1ed5d242 100644 --- a/Source/cmVTKWrapJavaCommand.cxx +++ b/Source/cmVTKWrapJavaCommand.cxx @@ -48,6 +48,15 @@ bool cmVTKWrapJavaCommand::InitialPass(std::vector const& argsIn) sourceListValue = def; } + // Prepare java dependency file + std::string resultDirectory = "${VTK_JAVA_HOME}"; + std::string res = m_Makefile->GetCurrentOutputDirectory(); + std::string depFileName = res + "/JavaDependencies.cmake"; + ofstream depFile(depFileName.c_str()); + depFile << "# This file is automatically generated by CMake VTK_WRAP_JAVA" + << std::endl << std::endl; + depFile << "SET(VTK_JAVA_DEPENDENCIES ${VTK_JAVA_DEPENDENCIES}" << std::endl; + // get the list of classes for this library for(std::vector::const_iterator j = (args.begin() + 2); j != args.end(); ++j) @@ -77,8 +86,15 @@ bool cmVTKWrapJavaCommand::InitialPass(std::vector const& argsIn) sourceListValue += ";"; } sourceListValue += newName + ".cxx"; + + // Write file to java dependency file + std::string jafaFile = resultDirectory + "/" + srcName + ".java"; + depFile << " " << jafaFile << std::endl; } } + + // Finalize java dependency file + depFile << ")" << std::endl; m_Makefile->AddDefinition(m_SourceList.c_str(), sourceListValue.c_str()); return true;