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 )