Medical Imaging Interaction Toolkit  2018.4.99-389bf124
Medical Imaging Interaction Toolkit
mitkSwigAddLibraryDependencies.cmake
Go to the documentation of this file.
1 #! This CMake macro adds the necessary library and incllude
2 #! directories to a swig-project.
3 #!
4 #! params:
5 #! swig_module : Name of the SWIG module, for example pyMITK
6 #! library_names : Semicolon separated list of the libraries that are included, for example "MitkCore;mbilog"
7 #!
8 
9 
10 # function inspired by
11 # https://stackoverflow.com/questions/37205274/swig-and-cmake-make-use-of-information-provided-by-target-include-directories
12 # This function tells cmake which additional dependencies are existing
13 # especially with respect to the linker dependencies.
14 function(mitkSwigAddLibraryDependencies swig_module library_names)
15  foreach(library_name ${library_names})
16  # Adding each library as a linker dependency:
17  swig_link_libraries(${swig_module} ${library_name})
18  # Extracting all include directories from each given project and
19  # then including these directories to the newly created swig project.
20  get_property(LIBRARY_INCLUDES
21  TARGET ${library_name}
22  PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
23  # Checking each given librarie to include all includes from this library.
24 
25  endforeach()
26 
27  # In addition include python dependencies:
28  include_directories( ${PYTHON_INCLUDE_DIR})
29 
30 endfunction()
mitkSwigAddLibraryDependencies(swig_module, library_names)
const std::string TARGET