ctkBlockCheckDependencies.cmake 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #
  2. # Independently of the value of CTK_SUPERBUILD, each external project definition will
  3. # provides either the include and library directories or a variable name
  4. # used by the corresponding Find<package>.cmake files.
  5. #
  6. # Within top-level CMakeLists.txt file, the variable names will be expanded if not in
  7. # superbuild mode. The include and library dirs are then used in
  8. # ctkMacroBuildApp, ctkMacroBuildLib, and ctkMacroBuildPlugin
  9. #
  10. #-----------------------------------------------------------------------------
  11. # Collect CTK library target dependencies
  12. #
  13. ctkMacroCollectAllTargetLibraries("${CTK_LIBS}" "Libs" ALL_TARGET_LIBRARIES)
  14. ctkMacroCollectAllTargetLibraries("${CTK_PLUGINS}" "Plugins" ALL_TARGET_LIBRARIES)
  15. ctkMacroCollectAllTargetLibraries("${CTK_APPS}" "Applications" ALL_TARGET_LIBRARIES)
  16. #message(STATUS ALL_TARGET_LIBRARIES:${ALL_TARGET_LIBRARIES})
  17. #-----------------------------------------------------------------------------
  18. # Initialize NON_CTK_DEPENDENCIES variable
  19. #
  20. # Using the variable ALL_TARGET_LIBRARIES initialized above with the help
  21. # of the macro ctkMacroCollectAllTargetLibraries, let's get the list of all Non-CTK dependencies.
  22. # NON_CTK_DEPENDENCIES is expected by the macro ctkMacroShouldAddExternalProject
  23. ctkMacroGetAllNonProjectTargetLibraries("${ALL_TARGET_LIBRARIES}" NON_CTK_DEPENDENCIES)
  24. #message(NON_CTK_DEPENDENCIES:${NON_CTK_DEPENDENCIES})
  25. #-----------------------------------------------------------------------------
  26. # Enable and setup External project global properties
  27. #
  28. if(CTK_SUPERBUILD)
  29. set(ep_install_dir ${CMAKE_BINARY_DIR}/CMakeExternals/Install)
  30. set(ep_suffix "-cmake")
  31. set(ep_common_c_flags "${CMAKE_C_FLAGS_INIT} ${ADDITIONAL_C_FLAGS}")
  32. set(ep_common_cxx_flags "${CMAKE_CXX_FLAGS_INIT} ${ADDITIONAL_CXX_FLAGS}")
  33. set(ep_common_cache_args
  34. -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
  35. -DCMAKE_C_COMPILER:FILEPATH=${CMAKE_C_COMPILER}
  36. -DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER}
  37. -DCMAKE_C_FLAGS:STRING=${ep_common_c_flags}
  38. -DCMAKE_CXX_FLAGS:STRING=${ep_common_cxx_flags}
  39. -DCMAKE_INSTALL_PREFIX:PATH=${ep_install_dir}
  40. -DBUILD_TESTING:BOOL=OFF
  41. )
  42. # Compute -G arg for configuring external projects with the same CMake generator:
  43. if(CMAKE_EXTRA_GENERATOR)
  44. set(gen "${CMAKE_EXTRA_GENERATOR} - ${CMAKE_GENERATOR}")
  45. else()
  46. set(gen "${CMAKE_GENERATOR}")
  47. endif()
  48. endif()
  49. if(NOT DEFINED CTK_DEPENDENCIES)
  50. message(FATAL_ERROR "error: CTK_DEPENDENCIES variable is not defined !")
  51. endif()
  52. superbuild_include_dependencies(CTK)
  53. #message("Updated CTK_DEPENDENCIES:")
  54. #foreach(dep ${CTK_DEPENDENCIES})
  55. # message(" ${dep}")
  56. #endforeach()