CMakeLists.txt 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. cmake_minimum_required(VERSION 3.24...3.28)
  2. project(cxx_modules_export_interfaces CXX)
  3. include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake")
  4. add_library(export_interfaces_no_properties STATIC)
  5. target_sources(export_interfaces_no_properties
  6. PRIVATE
  7. forward.cxx
  8. PRIVATE
  9. FILE_SET modules_private TYPE CXX_MODULES
  10. BASE_DIRS
  11. "${CMAKE_CURRENT_SOURCE_DIR}"
  12. FILES
  13. private.cxx
  14. PUBLIC
  15. FILE_SET modules TYPE CXX_MODULES
  16. BASE_DIRS
  17. "${CMAKE_CURRENT_SOURCE_DIR}"
  18. FILES
  19. importable.cxx
  20. subdir/importable.cxx
  21. )
  22. target_compile_features(export_interfaces_no_properties PUBLIC cxx_std_20)
  23. add_library(no_modules STATIC no_modules.cxx)
  24. install(TARGETS export_interfaces_no_properties no_modules
  25. EXPORT CXXModules
  26. FILE_SET modules DESTINATION "lib/cxx/miu")
  27. install(EXPORT CXXModules
  28. NAMESPACE CXXModules::
  29. DESTINATION "lib/cmake/export_interfaces_no_properties"
  30. FILE "export_interfaces_no_properties-targets.cmake")
  31. file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/export_interfaces_no_properties-config.cmake"
  32. "include(\"\${CMAKE_CURRENT_LIST_DIR}/export_interfaces_no_properties-targets.cmake\")
  33. set(\${CMAKE_FIND_PACKAGE_NAME}_FOUND 1)
  34. ")
  35. install(FILES "${CMAKE_CURRENT_BINARY_DIR}/export_interfaces_no_properties-config.cmake"
  36. DESTINATION "lib/cmake/export_interfaces_no_properties")
  37. set(generator
  38. -G "${CMAKE_GENERATOR}")
  39. if (CMAKE_GENERATOR_TOOLSET)
  40. list(APPEND generator
  41. -T "${CMAKE_GENERATOR_TOOLSET}")
  42. endif ()
  43. if (CMAKE_GENERATOR_PLATFORM)
  44. list(APPEND generator
  45. -A "${CMAKE_GENERATOR_PLATFORM}")
  46. endif ()
  47. add_test(NAME export_interfaces_build
  48. COMMAND
  49. "${CMAKE_COMMAND}"
  50. "-Dexpected_dir=${CMAKE_INSTALL_PREFIX}/lib/cxx/miu"
  51. "-Dexport_interfaces_no_properties_DIR=${CMAKE_INSTALL_PREFIX}/lib/cmake/export_interfaces_no_properties"
  52. ${generator}
  53. -S "${CMAKE_CURRENT_SOURCE_DIR}/test"
  54. -B "${CMAKE_CURRENT_BINARY_DIR}/test")