ctkFunctionGeneratePluginUseFile.cmake 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. IF(COMMAND GetMyTargetLibraries)
  25. GetMyTargetLibraries("${CTK_PLUGIN_LIBRARIES}" my_ctk_plugin_libraries)
  26. ELSE()
  27. SET(my_ctk_plugin_libraries ${CTK_PLUGIN_LIBRARIES})
  28. ENDIF()
  29. SET(CTK_PLUGIN_INCLUDE_DIRS_CONFIG)
  30. FOREACH(plugin ${my_ctk_plugin_libraries})
  31. SET(${plugin}_INCLUDE_DIRS )
  32. # The call to ctkFunctionGetIncludeDirs returns all include dirs
  33. # the plugin itself needs. This does not include the plugin's
  34. # source dir, so we add it explicitly.
  35. IF(${plugin}_INCLUDE_SUFFIXES)
  36. FOREACH(_suffix ${${plugin}_INCLUDE_SUFFIXES})
  37. LIST(APPEND ${plugin}_INCLUDE_DIRS ${${plugin}_SOURCE_DIR}/${_suffix})
  38. ENDFOREACH()
  39. ELSE()
  40. LIST(APPEND ${plugin}_INCLUDE_DIRS ${${plugin}_SOURCE_DIR})
  41. ENDIF()
  42. LIST(APPEND ${plugin}_INCLUDE_DIRS ${${plugin}_BINARY_DIR})
  43. ctkFunctionGetIncludeDirs(${plugin}_INCLUDE_DIRS ${plugin})
  44. SET(CTK_PLUGIN_INCLUDE_DIRS_CONFIG "${CTK_PLUGIN_INCLUDE_DIRS_CONFIG}
  45. SET(${plugin}_INCLUDE_DIRS \"${${plugin}_INCLUDE_DIRS}\")")
  46. ctkFunctionGetLibraryDirs(${plugin}_LIBRARY_DIRS ${plugin})
  47. SET(CTK_PLUGIN_LIBRARY_DIRS_CONFIG "${CTK_PLUGIN_LIBRARY_DIRS_CONFIG}
  48. SET(${plugin}_LIBRARY_DIRS \"${${plugin}_LIBRARY_DIRS}\")")
  49. ENDFOREACH()
  50. CONFIGURE_FILE("${CTK_CMAKE_DIR}/../CTKPluginUseFile.cmake.in" "${filename}" @ONLY)
  51. ENDFUNCTION()