Hi, using ExternalProject_Add is fine.
To create a dependency from a module, you might want to check the .cmake files in MITK/CMake/PackageDepends/ , they are exactly for this case. Note that there is the following naming convention for the file name: MITK_<package-name>_Config.cmake and you can optionally create a CMake option named MITK_USE_<package-name> which will be checked by the module CMake macros to decide if an error should be thrown if the module is used and MITK_USE_<package-name> is OFF. So you should write a file called <your-project>/CMake/PackageDepends/MITK_Minuit_Config.cmake which sets up the include and linker directories and adds the needed libs to ALL_LIBRARIES. Best, Sascha On 08/04/2011 07:43 PM, Miklos Espak wrote: > Hi, > > I have a module that depends on the Minuit2 library. > > http://seal.web.cern.ch/seal/work-packages/mathlibs/minuit/ > > I created an external project for it, and I can build it by "make > Minuit" from Linux or by right clicking and "Build" from VS2008. I do > not know, however, how to make the module depend on this project. I > added Minuit to the PACKAGE_DEPENDS section of the MITK_CREATE_MODULE > macro, but it does not trigger building Minuit. I also tried to add > "add_dependencies(DceAlgorithms Minuit)" but did not work. > > What is the way to do that? Or do you suggest to build Minuit as a > project utility instead? > > The module's CMakeLists.txt file: > > set(MINUIT_INCLUDE_DIR > ${CMAKE_BINARY_DIR}/../CMakeExternals/Source/Minuit/inc) > include_directories(${MINUIT_INCLUDE_DIR}) > > MITK_CREATE_MODULE(DceAlgorithms > INCLUDE_DIRS ${CMAKE_BINARY_DIR} > PACKAGE_DEPENDS Minuit > DEPENDS Mitk > ) > > set(MINUIT_LIBRARY_DIR ${CMAKE_BINARY_DIR}/../Minuit-build) > message(STATUS "minuit libs: " ${MINUIT_LIBRARY_DIR}) > > link_directories(${MINUIT_LIBRARY_DIR}) > > add_dependencies(DceAlgorithms Minuit) > target_link_libraries(DceAlgorithms Minuit2) > ----------------------- > > Another problem is that if I build Minuit first and then the module, > then I get the following error: > > Linking CXX shared library ../../bin/libDceAlgorithms.so > /usr/bin/ld: cannot find -lMinuit2 > collect2: ld returned 1 exit status > ... > > However, the libMinuit2.so is there at the ${MINUIT_LIBRARY_DIR} > directory what I added by the "link_directories" macro. > > Thanks, > Miklos > > ------------------------------------------------------------------------------ > BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA > The must-attend event for mobile developers. Connect with experts. > Get tools for creating Super Apps. See the latest technologies. > Sessions, hands-on labs, demos& much more. Register early& save! > http://p.sf.net/sfu/rim-blackberry-1 > _______________________________________________ > mitk-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/mitk-users ------------------------------------------------------------------------------ BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA The must-attend event for mobile developers. Connect with experts. Get tools for creating Super Apps. See the latest technologies. Sessions, hands-on labs, demos & much more. Register early & save! http://p.sf.net/sfu/rim-blackberry-1 _______________________________________________ mitk-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mitk-users
