CMakeLists.txt 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. ###########################################################################
  2. #
  3. # Library: CTK
  4. #
  5. # Copyright (c) 2010 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: Utilities/LastConfigureStep/CMakeLists.txt
  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. # The commands in this directory are intended to be executed as
  36. # the end of the whole configuration process, as a "last step".
  37. # This directory is typically the last SUBDIRS in the main CMakeLists.txt.
  38. # It enable the above commands to use variables that might have been configured
  39. # in previous SUBDIRS. This is especially important when it comes to
  40. # the CONFIGURE_FILE command, since in IMMEDIATE mode that command will
  41. # use the current values of CMake variables instead of waiting until the
  42. # end of CMakeLists processing, i.e. instead of waiting until some variables
  43. # are configured in SUBDIRS.
  44. SET(ctk_target_dependencies)
  45. # Loop over the list of CTK* targets and retrieve the associated dependencies
  46. FOREACH(ctk_target ${CTEST_PROJECT_SUBPROJECTS})
  47. LIST(APPEND ctk_target_dependencies ${${ctk_target}_LIB_DEPENDS})
  48. ENDFOREACH()
  49. SET(CTK_EXTERNAL_LIBRARIES)
  50. # Loop over dependencies and append to CTK_EXTERNAL_LIBRARIES
  51. # target dependency which are neither CTK or static library
  52. SET(link_type)
  53. FOREACH(ctk_target_dependency ${ctk_target_dependencies})
  54. STRING(REGEX MATCH "(general|optimized|debug)" is_link_type ${ctk_target_dependency})
  55. IF(is_link_type)
  56. SET(link_type ${ctk_target_dependency})
  57. ELSE()
  58. # Sanity checks - link_type shouldn't be empty
  59. IF(link_type STREQUAL "")
  60. MESSAGE(SEND_ERROR "link_type shouldn't be empty")
  61. ENDIF()
  62. # Make sure ctk_target_dependency is not a CTK library
  63. STRING(REGEX MATCH "(^(c|C)(t|T)(k|K)[a-zA-Z0-9]+$)" is_ctk_library ${ctk_target_dependency})
  64. IF(NOT is_ctk_library)
  65. # Make sure ctk_target_dependency is not a static library
  66. GET_FILENAME_COMPONENT(ctk_target_dependency_ext ${ctk_target_dependency} EXT)
  67. IF(NOT ctk_target_dependency_ext STREQUAL CMAKE_STATIC_LIBRARY_SUFFIX)
  68. LIST(APPEND CTK_EXTERNAL_LIBRARIES ${link_type} ${ctk_target_dependency})
  69. ENDIF()
  70. SET(link_type)
  71. ENDIF()
  72. ENDIF()
  73. ENDFOREACH()
  74. #-----------------------------------------------------------------------------
  75. # Create the CTKConfig.cmake file containing the CTK configuration.
  76. # Since it might generate configuration file depending
  77. INCLUDE(CTKGenerateCTKConfig.cmake)