3 # This is not really a circular dependency. "case4Bar" refers to a
4 # third-party library that happens to match the executable name, which
5 # is okay when the executable is not a linkable target (ENABLE_EXPORTS
6 # is not set). This tests whether CMake avoids incorrectly reporting
7 # a circular dependency. In practice case4Foo may be a shared
8 # library, but we skip that here because we do not want it to actually
9 # have to find the third-party library.
10 add_library(case4Foo STATIC foo.c)
11 target_link_libraries(case4Foo case4Bar)
13 # The executable avoids linking to a library with its own name, which
14 # has been a CMake-ism for a long time, so we will not get a link
15 # failure. An imported target or executable with an OUTPUT_NAME set
16 # may be used if the user really wants to link a third-party library
17 # into an executable of the same name.
18 add_executable(case4Bar bar.c)
19 target_link_libraries(case4Bar case4Foo)