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