CTK  0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
ctkFunctionGeneratePluginUseFile.cmake
Go to the documentation of this file.
1 ###########################################################################
2 #
3 # Library: CTK
4 #
5 # Copyright (c) German Cancer Research Center,
6 # Division of Medical and Biological Informatics
7 #
8 # Licensed under the Apache License, Version 2.0 (the "License");
9 # you may not use this file except in compliance with the License.
10 # You may obtain a copy of the License at
11 #
12 # http://www.apache.org/licenses/LICENSE-2.0
13 #
14 # Unless required by applicable law or agreed to in writing, software
15 # distributed under the License is distributed on an "AS IS" BASIS,
16 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 # See the License for the specific language governing permissions and
18 # limitations under the License.
19 #
20 ###########################################################################
21 
22 #! Write a set of variables containing CTK plugin specific include and library directories
23 #! \ingroup CMakeAPI
24 function(ctkFunctionGeneratePluginUseFile filename)
25  set(CTK_PLUGIN_INCLUDE_DIRS_CONFIG)
26 
27  foreach(plugin ${${CMAKE_PROJECT_NAME}_PLUGIN_LIBRARIES})
28  set(${plugin}_INCLUDE_DIRS )
29 
30  # The call to ctkFunctionGetIncludeDirs returns all include dirs
31  # the plugin itself needs. This does not include the plugin's
32  # source dir, so we add it explicitly.
33  if(${plugin}_INCLUDE_SUFFIXES)
34  foreach(_suffix ${${plugin}_INCLUDE_SUFFIXES})
35  list(APPEND ${plugin}_INCLUDE_DIRS ${${plugin}_SOURCE_DIR}/${_suffix})
36  endforeach()
37  else()
38  list(APPEND ${plugin}_INCLUDE_DIRS ${${plugin}_SOURCE_DIR})
39  endif()
40 
41  list(APPEND ${plugin}_INCLUDE_DIRS ${${plugin}_BINARY_DIR})
42 
43  ctkFunctionGetIncludeDirs(${plugin}_INCLUDE_DIRS ${plugin})
44 
45  set(CTK_PLUGIN_INCLUDE_DIRS_CONFIG "${CTK_PLUGIN_INCLUDE_DIRS_CONFIG}
46 set(${plugin}_INCLUDE_DIRS \"${${plugin}_INCLUDE_DIRS}\")")
47 
48  ctkFunctionGetLibraryDirs(${plugin}_LIBRARY_DIRS ${plugin})
49  set(CTK_PLUGIN_LIBRARY_DIRS_CONFIG "${CTK_PLUGIN_LIBRARY_DIRS_CONFIG}
50 set(${plugin}_LIBRARY_DIRS \"${${plugin}_LIBRARY_DIRS}\")")
51  endforeach()
52 
53  set(_ctk_plugin_libraries_variable ${CMAKE_PROJECT_NAME}_PLUGIN_LIBRARIES)
54  set(_ctk_plugin_libraries ${${CMAKE_PROJECT_NAME}_PLUGIN_LIBRARIES})
55 
56  configure_file("${CTK_CMAKE_DIR}/../CMake/CTKPluginUseFile.cmake.in" "${filename}" @ONLY)
57 endfunction()