CMakeLists.txt 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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: 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 at
  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. # Clean variable
  75. list(REMOVE_DUPLICATES CTK_BASE_INCLUDE_DIRS)
  76. #-----------------------------------------------------------------------------
  77. # Create the CTKConfig.cmake file containing the CTK configuration.
  78. # Since it might generate configuration file depending
  79. include(CTKGenerateCTKConfig.cmake)