CTKGenerateCTKConfig.cmake 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. ###########################################################################
  2. #
  3. # Library: CTK
  4. #
  5. # Copyright (c) Kitware Inc.
  6. #
  7. # Licensed under the Apache License, Version 2.0 (the "License");
  8. # you may not use this file except in compliance with the License.
  9. # You may obtain a copy of the License at
  10. #
  11. # http://www.commontk.org/LICENSE
  12. #
  13. # Unless required by applicable law or agreed to in writing, software
  14. # distributed under the License is distributed on an "AS IS" BASIS,
  15. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16. # See the License for the specific language governing permissions and
  17. # limitations under the License.
  18. #
  19. ###########################################################################
  20. ###########################################################################
  21. #
  22. # Program: Visualization Toolkit
  23. # Module: vtkGenerateVTKConfig.cmake
  24. #
  25. # Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
  26. #
  27. # All rights reserved.
  28. # See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
  29. #
  30. # This software is distributed WITHOUT ANY WARRANTY; without even
  31. # the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  32. # PURPOSE. See the above copyright notice for more information.
  33. #
  34. ###########################################################################
  35. #
  36. # Generate the CTKConfig.cmake file in the build tree. Also configure
  37. # one for installation. The file tells external projects how to use CTK.
  38. #
  39. # Construct version numbers for CTKConfigVersion.cmake.
  40. SET(_CTK_VERSION_MAJOR ${CTK_MAJOR_VERSION})
  41. SET(_CTK_VERSION_MINOR ${CTK_MINOR_VERSION})
  42. SET(_CTK_VERSION_PATCH ${CTK_BUILD_VERSION})
  43. # We use odd minor numbers for development versions.
  44. # Use a date for the development patch level.
  45. # IF("${_CTK_VERSION_MINOR}" MATCHES "[13579]$")
  46. # INCLUDE(${CTK_SOURCE_DIR}/Utilities/kwsys/kwsysDateStamp.cmake)
  47. # SET(_CTK_VERSION_PATCH
  48. # "${KWSYS_DATE_STAMP_YEAR}${KWSYS_DATE_STAMP_MONTH}${KWSYS_DATE_STAMP_DAY}"
  49. # )
  50. # ENDIF()
  51. #-----------------------------------------------------------------------------
  52. # Settings shared between the build tree and install tree.
  53. #-----------------------------------------------------------------------------
  54. # Settings specific to the build tree.
  55. # The install-only section is empty for the build tree.
  56. SET(CTK_CONFIG_INSTALL_ONLY)
  57. # The "use" file.
  58. SET(CTK_USE_FILE ${CTK_SUPERBUILD_BINARY_DIR}/UseCTK.cmake)
  59. # Generate list of target to exports
  60. SET(CTK_TARGETS_TO_EXPORT ${CTK_LIBRARIES} ${CTK_PLUGIN_LIBRARIES})
  61. # Append CTK PythonQt static libraries
  62. FOREACH(lib ${CTK_WRAPPED_LIBRARIES_PYTHONQT})
  63. LIST(APPEND CTK_TARGETS_TO_EXPORT ${lib}PythonQt)
  64. ENDFOREACH()
  65. # Export targets so they can be imported by a project using CTK
  66. # as an external library
  67. EXPORT(TARGETS ${CTK_TARGETS_TO_EXPORT} FILE ${CTK_SUPERBUILD_BINARY_DIR}/CTKExports.cmake)
  68. # Write a set of variables containing plugin specific include and library directories
  69. SET(CTK_PLUGIN_INCLUDE_DIRS_CONFIG)
  70. FOREACH(plugin ${CTK_PLUGIN_LIBRARIES})
  71. SET(${plugin}_INCLUDE_DIRS ${${plugin}_SOURCE_DIR} ${${plugin}_BINARY_DIR})
  72. ctkFunctionGetIncludeDirs(${plugin}_INCLUDE_DIRS ${plugin})
  73. SET(CTK_PLUGIN_INCLUDE_DIRS_CONFIG "${CTK_PLUGIN_INCLUDE_DIRS_CONFIG}
  74. SET(${plugin}_INCLUDE_DIRS \"${${plugin}_INCLUDE_DIRS}\")")
  75. ctkFunctionGetLibraryDirs(${plugin}_LIBRARY_DIRS ${plugin})
  76. SET(CTK_PLUGIN_LIBRARY_DIRS_CONFIG "${CTK_PLUGIN_LIBRARY_DIRS_CONFIG}
  77. SET(${plugin}_LIBRARY_DIRS \"${${plugin}_LIBRARY_DIRS}\")")
  78. ENDFOREACH()
  79. # Write a set of variables containing library specific include and library directories
  80. SET(CTK_LIBRARY_INCLUDE_DIRS_CONFIG)
  81. FOREACH(lib ${CTK_LIBRARIES})
  82. SET(${lib}_INCLUDE_DIRS ${${lib}_SOURCE_DIR} ${${lib}_BINARY_DIR})
  83. ctkFunctionGetIncludeDirs(${lib}_INCLUDE_DIRS ${lib})
  84. SET(CTK_LIBRARY_INCLUDE_DIRS_CONFIG "${CTK_LIBRARY_INCLUDE_DIRS_CONFIG}
  85. SET(${lib}_INCLUDE_DIRS \"${${lib}_INCLUDE_DIRS}\")")
  86. ctkFunctionGetLibraryDirs(${lib}_LIBRARY_DIRS ${lib})
  87. SET(CTK_LIBRARY_LIBRARY_DIRS_CONFIG "${CTK_LIBRARY_LIBRARY_DIRS_CONFIG}
  88. SET(${lib}_LIBRARY_DIRS \"${${lib}_LIBRARY_DIRS}\")")
  89. ENDFOREACH()
  90. # Determine the include directories needed.
  91. SET(CTK_INCLUDE_DIRS_CONFIG
  92. ${CTK_BASE_INCLUDE_DIRS}
  93. )
  94. # Library directory.
  95. SET(CTK_LIBRARY_DIRS_CONFIG ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
  96. # External project libraries.
  97. SET(CTK_EXTERNAL_LIBRARIES_CONFIG ${CTK_EXTERNAL_LIBRARIES})
  98. # External project library directory.
  99. SET(CTK_EXTERNAL_LIBRARY_DIRS_CONFIG ${CTK_EXTERNAL_LIBRARY_DIRS})
  100. # Runtime library directory.
  101. SET(CTK_RUNTIME_LIBRARY_DIRS_CONFIG ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
  102. # Binary executable directory.
  103. SET(CTK_EXECUTABLE_DIRS_CONFIG ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
  104. # QtDesigner plugins directory
  105. SET(CTK_QTDESIGNERPLUGINS_DIR_CONFIG ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
  106. # PythonQt directory
  107. SET(CTK_PYTHONQT_INSTALL_DIR_CONFIG ${PYTHONQT_INSTALL_DIR})
  108. # Executable locations.
  109. # CMake extension module directory.
  110. SET(CTK_CMAKE_DIR_CONFIG ${CTK_CMAKE_DIR})
  111. SET(CTK_CMAKE_UTILITIES_DIR_CONFIG ${CTK_CMAKE_UTILITIES_DIR})
  112. # Build configuration information.
  113. SET(CTK_CONFIGURATION_TYPES_CONFIG ${CMAKE_CONFIGURATION_TYPES})
  114. SET(CTK_BUILD_TYPE_CONFIG ${CMAKE_BUILD_TYPE})
  115. #-----------------------------------------------------------------------------
  116. # Configure CTKConfig.cmake for the build tree.
  117. CONFIGURE_FILE(${CTK_SOURCE_DIR}/CTKConfig.cmake.in
  118. ${CTK_SUPERBUILD_BINARY_DIR}/CTKConfig.cmake @ONLY IMMEDIATE)
  119. CONFIGURE_FILE(${CTK_SOURCE_DIR}/CTKConfigVersion.cmake.in
  120. ${CTK_SUPERBUILD_BINARY_DIR}/CTKConfigVersion.cmake @ONLY IMMEDIATE)
  121. CONFIGURE_FILE(${CTK_SOURCE_DIR}/CTKConfig.h.in
  122. ${CTK_SUPERBUILD_BINARY_DIR}/CTKConfig.h @ONLY IMMEDIATE)
  123. #-----------------------------------------------------------------------------
  124. # Settings specific to the install tree.
  125. #-----------------------------------------------------------------------------
  126. # Configure CTKConfig.cmake for the install tree.