CTKGenerateCTKConfig.cmake 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  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.apache.org/licenses/LICENSE-2.0.txt
  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. INCLUDE(ctkFunctionGeneratePluginUseFile)
  40. # Construct version numbers for CTKConfigVersion.cmake.
  41. SET(_CTK_VERSION_MAJOR ${CTK_MAJOR_VERSION})
  42. SET(_CTK_VERSION_MINOR ${CTK_MINOR_VERSION})
  43. SET(_CTK_VERSION_PATCH ${CTK_BUILD_VERSION})
  44. # We use odd minor numbers for development versions.
  45. # Use a date for the development patch level.
  46. # IF("${_CTK_VERSION_MINOR}" MATCHES "[13579]$")
  47. # INCLUDE(${CTK_SOURCE_DIR}/Utilities/kwsys/kwsysDateStamp.cmake)
  48. # SET(_CTK_VERSION_PATCH
  49. # "${KWSYS_DATE_STAMP_YEAR}${KWSYS_DATE_STAMP_MONTH}${KWSYS_DATE_STAMP_DAY}"
  50. # )
  51. # ENDIF()
  52. #-----------------------------------------------------------------------------
  53. # Settings shared between the build tree and install tree.
  54. #-----------------------------------------------------------------------------
  55. # Settings specific to the build tree.
  56. # The install-only section is empty for the build tree.
  57. SET(CTK_CONFIG_INSTALL_ONLY)
  58. # The "use" file.
  59. SET(CTK_USE_FILE ${CTK_SUPERBUILD_BINARY_DIR}/UseCTK.cmake)
  60. # Generate list of target to exports
  61. SET(CTK_TARGETS_TO_EXPORT ${CTK_LIBRARIES} ${CTK_PLUGIN_LIBRARIES})
  62. # Append CTK PythonQt static libraries
  63. IF(NOT CTK_BUILD_SHARED_LIBS)
  64. FOREACH(lib ${CTK_WRAPPED_LIBRARIES_PYTHONQT})
  65. LIST(APPEND CTK_TARGETS_TO_EXPORT ${lib}PythonQt)
  66. ENDFOREACH()
  67. ENDIF()
  68. # Export targets so they can be imported by a project using CTK
  69. # as an external library
  70. EXPORT(TARGETS ${CTK_TARGETS_TO_EXPORT} FILE ${CTK_SUPERBUILD_BINARY_DIR}/CTKExports.cmake)
  71. # Generate a file containing plugin specific variables
  72. SET(CTK_PLUGIN_USE_FILE "${CTK_SUPERBUILD_BINARY_DIR}/CTKPluginUseFile.cmake")
  73. ctkFunctionGeneratePluginUseFile(${CTK_PLUGIN_USE_FILE})
  74. # Write a set of variables containing library specific include and library directories
  75. SET(CTK_LIBRARY_INCLUDE_DIRS_CONFIG)
  76. FOREACH(lib ${CTK_LIBRARIES})
  77. SET(${lib}_INCLUDE_DIRS ${${lib}_SOURCE_DIR} ${${lib}_BINARY_DIR})
  78. ctkFunctionGetIncludeDirs(${lib}_INCLUDE_DIRS ${lib})
  79. SET(CTK_LIBRARY_INCLUDE_DIRS_CONFIG "${CTK_LIBRARY_INCLUDE_DIRS_CONFIG}
  80. SET(${lib}_INCLUDE_DIRS \"${${lib}_INCLUDE_DIRS}\")")
  81. ctkFunctionGetLibraryDirs(${lib}_LIBRARY_DIRS ${lib})
  82. SET(CTK_LIBRARY_LIBRARY_DIRS_CONFIG "${CTK_LIBRARY_LIBRARY_DIRS_CONFIG}
  83. SET(${lib}_LIBRARY_DIRS \"${${lib}_LIBRARY_DIRS}\")")
  84. ENDFOREACH()
  85. # Determine the include directories needed.
  86. SET(CTK_INCLUDE_DIRS_CONFIG
  87. ${CTK_BASE_INCLUDE_DIRS}
  88. )
  89. # Library directory.
  90. SET(CTK_LIBRARY_DIRS_CONFIG ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
  91. # Plug-in output directory
  92. IF(WIN32)
  93. SET(_plugin_output_type "RUNTIME")
  94. ELSE()
  95. SET(_plugin_output_type "LIBRARY")
  96. ENDIF()
  97. IF(DEFINED CTK_PLUGIN_${_plugin_output_type}_OUTPUT_DIRECTORY)
  98. IF(IS_ABSOLUTE "${CTK_PLUGIN_${_plugin_output_type}_OUTPUT_DIRECTORY}")
  99. SET(CTK_PLUGIN_LIBRARIES_DIR_CONFIG "${CTK_PLUGIN_${_plugin_output_type}_OUTPUT_DIRECTORY}")
  100. ELSE()
  101. SET(CTK_PLUGIN_LIBRARIES_DIR_CONFIG "${CMAKE_${_plugin_output_type}_OUTPUT_DIRECTORY}/${CTK_PLUGIN_${_plugin_output_type}_OUTPUT_DIRECTORY}")
  102. ENDIF()
  103. ELSE()
  104. SET(CTK_PLUGIN_LIBRARIES_DIR_CONFIG "${CMAKE_${_plugin_output_type}_OUTPUT_DIRECTORY}/plugins")
  105. ENDIF()
  106. # External project libraries.
  107. SET(CTK_EXTERNAL_LIBRARIES_CONFIG ${CTK_EXTERNAL_LIBRARIES})
  108. # External project library directory.
  109. SET(CTK_EXTERNAL_LIBRARY_DIRS_CONFIG ${CTK_EXTERNAL_LIBRARY_DIRS})
  110. # Runtime library directory.
  111. SET(CTK_RUNTIME_LIBRARY_DIRS_CONFIG ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
  112. # Binary executable directory.
  113. SET(CTK_EXECUTABLE_DIRS_CONFIG ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
  114. # QtDesigner plugins directory
  115. SET(CTK_QTDESIGNERPLUGINS_DIR_CONFIG ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
  116. # CTK external projects variables
  117. STRING(REPLACE "^" ";" CTK_SUPERBUILD_EP_VARNAMES "${CTK_SUPERBUILD_EP_VARNAMES}")
  118. SET(CTK_SUPERBUILD_EP_VARS_CONFIG)
  119. FOREACH(varname ${CTK_SUPERBUILD_EP_VARNAMES})
  120. SET(CTK_SUPERBUILD_EP_VARS_CONFIG
  121. "${CTK_SUPERBUILD_EP_VARS_CONFIG}
  122. SET(CTK_${varname} \"${${varname}}\")")
  123. ENDFOREACH()
  124. # Executable locations.
  125. # CMake extension module directory.
  126. SET(CTK_CMAKE_DIR_CONFIG ${CTK_CMAKE_DIR})
  127. SET(CTK_CMAKE_UTILITIES_DIR_CONFIG ${CTK_CMAKE_UTILITIES_DIR})
  128. # Build configuration information.
  129. SET(CTK_CONFIGURATION_TYPES_CONFIG ${CMAKE_CONFIGURATION_TYPES})
  130. SET(CTK_BUILD_TYPE_CONFIG ${CMAKE_BUILD_TYPE})
  131. #-----------------------------------------------------------------------------
  132. # Configure CTKConfig.cmake for the build tree.
  133. CONFIGURE_FILE(${CTK_SOURCE_DIR}/CTKConfig.cmake.in
  134. ${CTK_SUPERBUILD_BINARY_DIR}/CTKConfig.cmake @ONLY IMMEDIATE)
  135. CONFIGURE_FILE(${CTK_SOURCE_DIR}/CTKConfigVersion.cmake.in
  136. ${CTK_SUPERBUILD_BINARY_DIR}/CTKConfigVersion.cmake @ONLY IMMEDIATE)
  137. CONFIGURE_FILE(${CTK_SOURCE_DIR}/ctkConfig.h.in
  138. ${CTK_CONFIG_H_INCLUDE_DIR}/ctkConfig.h @ONLY IMMEDIATE)
  139. #-----------------------------------------------------------------------------
  140. # Settings specific to the install tree.
  141. #-----------------------------------------------------------------------------
  142. # Configure CTKConfig.cmake for the install tree.