CMakeLists.txt 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. project( LinkLineOrder )
  2. # This tests ensures that the order of libraries are preserved when
  3. # they don't have dependency information, even if they are deep in the
  4. # dependency tree.
  5. # NoDepC depends on NoDepA which depends on NoDepB. NoDepE and NoDepF
  6. # are dependent on each other (recursive dependency). However, CMake
  7. # has no information about these libraries except for the order they
  8. # are specified in One. We must make sure we don't lose that.
  9. add_library( NoDepA NoDepA.c )
  10. add_library( NoDepB NoDepB.c )
  11. add_library( NoDepC NoDepC.c )
  12. add_library( NoDepE NoDepE.c )
  13. add_library( NoDepF NoDepF.c )
  14. add_library( One One.c )
  15. target_link_libraries( One NoDepC NoDepA NoDepB NoDepE NoDepF NoDepE )
  16. add_executable( Exec1 Exec1.c )
  17. target_link_libraries( Exec1 One )
  18. # Similar situation as One, except at a different level of the
  19. # dependency tree. This makes sure that the order is presevered
  20. # everywhere in the graph.
  21. add_library( NoDepX NoDepX.c )
  22. add_library( NoDepY NoDepY.c )
  23. add_library( NoDepZ NoDepZ.c )
  24. add_library( Two Two.c )
  25. target_link_libraries( Two One NoDepZ NoDepX NoDepY )
  26. add_executable( Exec2 Exec2.c )
  27. target_link_libraries( Exec2 Two )