CMakeLists.txt 934 B

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