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