ctkFunctionGeneratePluginUseFile.cmake 2.3 KB

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