You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

71 lines
2.3 KiB

2 months ago
  1. option(EXPORT_TO_CMAKE "Export the project to CMake for easy inclusion" ON)
  2. # Add all targets to the build-tree export set
  3. export(TARGETS ${CARL_TARGETS} FILE "${PROJECT_BINARY_DIR}/carlTargets.cmake")
  4. # Export the package for use from the build-tree
  5. # (this registers the build-tree with a global CMake-registry)
  6. if(EXPORT_TO_CMAKE)
  7. message(STATUS "Registered with cmake")
  8. export(PACKAGE carl)
  9. endif()
  10. set(DEP_TARGETS "")
  11. if(USE_BLISS)
  12. export_target(DEP_TARGETS BLISS_SHARED)
  13. export_target(DEP_TARGETS BLISS_STATIC)
  14. endif()
  15. if(USE_CLN_NUMBERS)
  16. export_target(DEP_TARGETS CLN_SHARED)
  17. export_target(DEP_TARGETS CLN_STATIC GMP_STATIC)
  18. endif()
  19. if(USE_GINAC)
  20. export_target(DEP_TARGETS GINAC_SHARED CLN_SHARED)
  21. export_target(DEP_TARGETS GINAC_STATIC CLN_STATIC)
  22. endif()
  23. if(USE_COCOA)
  24. export_target(DEP_TARGETS COCOA_SHARED GMPXX_SHARED GMP_SHARED pthread)
  25. export_target(DEP_TARGETS COCOA_STATIC GMPXX_STATIC GMP_STATIC pthread)
  26. endif()
  27. export_target(DEP_TARGETS GMP_SHARED)
  28. export_target(DEP_TARGETS GMP_STATIC)
  29. export_target(DEP_TARGETS GMPXX_SHARED)
  30. export_target(DEP_TARGETS GMPXX_STATIC GMP_STATIC)
  31. export_target(DEP_TARGETS EIGEN3)
  32. export_target_recursive(DEP_TARGETS Boost_SHARED INTERFACE_LINK_LIBRARIES)
  33. export_target_recursive(DEP_TARGETS Boost_STATIC INTERFACE_LINK_LIBRARIES)
  34. export_target(DEP_TARGETS Doxygen::doxygen)
  35. set(EXP_OPTIONS "")
  36. foreach(option ${EXPORTED_OPTIONS})
  37. set(EXP_OPTIONS "${EXP_OPTIONS}\nset(CARL_${option} \"${${option}}\")")
  38. endforeach()
  39. include(CMakePackageConfigHelpers)
  40. write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/carlConfigVersion.cmake
  41. COMPATIBILITY AnyNewerVersion
  42. )
  43. # ... for the build tree
  44. set(CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/src") # TODO looks not correct, this would be hypro_INCLUDE_DIR
  45. configure_package_config_file(
  46. cmake/carlConfig.cmake.in
  47. ${PROJECT_BINARY_DIR}/carlConfig.cmake
  48. INSTALL_DESTINATION ${PROJECT_BINARY_DIR}
  49. PATH_VARS INCLUDE_INSTALL_DIR #SYSCONFIG_INSTALL_DIR
  50. )
  51. # ... for the install tree
  52. file(RELATIVE_PATH REL_INCLUDE_DIR "${CMAKE_INSTALL_DIR}" "${INCLUDE_INSTALL_DIR}")
  53. set(CONF_INCLUDE_DIRS "\${carl_CMAKE_DIR}/${REL_INCLUDE_DIR}")
  54. configure_package_config_file(
  55. cmake/carlConfig.cmake.in
  56. ${PROJECT_BINARY_DIR}/carlConfig.install.cmake
  57. INSTALL_DESTINATION ${CMAKE_INSTALL_DIR}
  58. PATH_VARS INCLUDE_INSTALL_DIR #SYSCONFIG_INSTALL_DIR
  59. )