1 cmake_minimum_required (VERSION 2.6)
5 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_ANSI_CFLAGS}")
6 endif(CMAKE_ANSI_CFLAGS)
8 # Add a simple chain of shared libraries that must be found.
9 add_library(foo1 SHARED foo1.c)
10 set_property(TARGET foo1 PROPERTY OUTPUT_NAME foo)
11 set_property(TARGET foo1 PROPERTY LIBRARY_OUTPUT_DIRECTORY A)
13 add_library(bar1 SHARED bar1.c)
14 set_property(TARGET bar1 PROPERTY OUTPUT_NAME bar)
15 set_property(TARGET bar1 PROPERTY VERSION 1)
16 set_property(TARGET bar1 PROPERTY LIBRARY_OUTPUT_DIRECTORY B)
17 target_link_libraries(bar1 foo1)
19 add_executable(RuntimePath main.c)
20 target_link_libraries(RuntimePath bar1)
22 # Add a library that provides a conflicting location to make sure
23 # rpath ordering works.
24 add_library(foo2 SHARED foo2.c)
25 set_property(TARGET foo2 PROPERTY OUTPUT_NAME foo)
26 set_property(TARGET foo2 PROPERTY LIBRARY_OUTPUT_DIRECTORY B)
28 # Add a library that would provide a conflicting location if not for
29 # soname analysis in rpath ordering. This will also break the old
30 # link directory ordering to make sure files are linked with full
32 if(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG)
33 add_library(bar2 SHARED bar2.c)
34 set_property(TARGET bar2 PROPERTY OUTPUT_NAME bar)
35 set_property(TARGET bar2 PROPERTY LIBRARY_OUTPUT_DIRECTORY A)
36 target_link_libraries(bar2 foo2)
37 endif(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG)