SuperBuild.cmake 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. # WARNING - No change should be required after this comment
  22. # when you are adding a new external project dependency.
  23. #-----------------------------------------------------------------------------
  24. #-----------------------------------------------------------------------------
  25. # Make sure ${CTK_BINARY_DIR}/CTK-build/bin exists
  26. # May be used by some external project to install libs
  27. if(NOT EXISTS ${CTK_BINARY_DIR}/CTK-build/bin)
  28. file(MAKE_DIRECTORY ${CTK_BINARY_DIR}/CTK-build/bin)
  29. endif()
  30. #-----------------------------------------------------------------------------
  31. set(proj CTK)
  32. set(ep_cxx_standard_arg)
  33. if(CMAKE_CXX_STANDARD)
  34. set(ep_cxx_standard_arg "-DCMAKE_CXX_STANDARD:STRING=${CMAKE_CXX_STANDARD}")
  35. endif()
  36. # Add install command
  37. if(WIN32)
  38. set(_INSTALL_CMD mingw32-make install)
  39. else()
  40. set(_INSTALL_CMD make install)
  41. endif()
  42. # Set install location
  43. if(CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
  44. set(_INSTALL_DIR ${CTK_BINARY_DIR}/../CTKInstallR)
  45. else()
  46. set(_INSTALL_DIR ${CTK_BINARY_DIR}/../CTKInstallD)
  47. endif()
  48. ExternalProject_Add(${proj}
  49. ${${proj}_EP_ARGS}
  50. DOWNLOAD_COMMAND ""
  51. CMAKE_CACHE_ARGS
  52. -DCTK_SUPERBUILD:BOOL=OFF
  53. -DCTK_SUPERBUILD_BINARY_DIR:PATH=${CTK_BINARY_DIR}
  54. -DCMAKE_C_COMPILER:FILEPATH=${CMAKE_C_COMPILER}
  55. -DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER}
  56. -DCMAKE_CXX_FLAGS_INIT:STRING=${CMAKE_CXX_FLAGS_INIT}
  57. -DCMAKE_C_FLAGS_INIT:STRING=${CMAKE_C_FLAGS_INIT}
  58. -DCMAKE_INSTALL_PREFIX:PATH=${_INSTALL_DIR}
  59. -DCMAKE_MACOSX_RPATH:BOOL=${CMAKE_MACOSX_RPATH}
  60. ${ep_cxx_standard_arg}
  61. SOURCE_DIR ${CTK_SOURCE_DIR}
  62. BINARY_DIR ${CTK_BINARY_DIR}/CTK-build
  63. INSTALL_COMMAND ${_INSTALL_CMD}
  64. DEPENDS
  65. ${CTK_DEPENDENCIES}
  66. )
  67. ExternalProject_AlwaysConfigure(${proj})