ctkFunctionGeneratePluginUseFile.cmake 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. #! Write a set of variables containing CTK plugin specific include and library directories
  22. #! \ingroup CMakeAPI
  23. function(ctkFunctionGeneratePluginUseFile filename)
  24. set(CTK_PLUGIN_INCLUDE_DIRS_CONFIG)
  25. foreach(plugin ${${CMAKE_PROJECT_NAME}_PLUGIN_LIBRARIES})
  26. set(${plugin}_INCLUDE_DIRS )
  27. # The call to ctkFunctionGetIncludeDirs returns all include dirs
  28. # the plugin itself needs. This does not include the plugin's
  29. # source dir, so we add it explicitly.
  30. if(${plugin}_INCLUDE_SUFFIXES)
  31. foreach(_suffix ${${plugin}_INCLUDE_SUFFIXES})
  32. list(APPEND ${plugin}_INCLUDE_DIRS ${${plugin}_SOURCE_DIR}/${_suffix})
  33. endforeach()
  34. else()
  35. list(APPEND ${plugin}_INCLUDE_DIRS ${${plugin}_SOURCE_DIR})
  36. endif()
  37. list(APPEND ${plugin}_INCLUDE_DIRS ${${plugin}_BINARY_DIR})
  38. ctkFunctionGetIncludeDirs(${plugin}_INCLUDE_DIRS ${plugin})
  39. set(CTK_PLUGIN_INCLUDE_DIRS_CONFIG "${CTK_PLUGIN_INCLUDE_DIRS_CONFIG}
  40. set(${plugin}_INCLUDE_DIRS \"${${plugin}_INCLUDE_DIRS}\")")
  41. ctkFunctionGetLibraryDirs(${plugin}_LIBRARY_DIRS ${plugin})
  42. set(CTK_PLUGIN_LIBRARY_DIRS_CONFIG "${CTK_PLUGIN_LIBRARY_DIRS_CONFIG}
  43. set(${plugin}_LIBRARY_DIRS \"${${plugin}_LIBRARY_DIRS}\")")
  44. endforeach()
  45. set(_ctk_plugin_libraries_variable ${CMAKE_PROJECT_NAME}_PLUGIN_LIBRARIES)
  46. set(_ctk_plugin_libraries ${${CMAKE_PROJECT_NAME}_PLUGIN_LIBRARIES})
  47. configure_file("${CTK_CMAKE_DIR}/../CMake/CTKPluginUseFile.cmake.in" "${filename}" @ONLY)
  48. endfunction()