2008-03-25 18:27:18 +03:00
|
|
|
cmake_minimum_required (VERSION 2.6)
|
2008-01-28 16:40:21 +03:00
|
|
|
project(Export C)
|
|
|
|
|
|
|
|
# We need ansi C support.
|
|
|
|
if(CMAKE_ANSI_CFLAGS)
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_ANSI_CFLAGS}")
|
|
|
|
endif(CMAKE_ANSI_CFLAGS)
|
|
|
|
|
2008-01-28 21:37:59 +03:00
|
|
|
add_library(testExe1lib STATIC testExe1lib.c) # not exported
|
2008-01-28 16:40:21 +03:00
|
|
|
add_executable(testExe1 testExe1.c)
|
2008-01-28 21:37:59 +03:00
|
|
|
target_link_libraries(testExe1 testExe1lib)
|
2008-02-06 22:20:36 +03:00
|
|
|
set_property(TARGET testExe1 PROPERTY VERSION 4)
|
2008-01-28 16:40:21 +03:00
|
|
|
|
2008-01-31 01:26:09 +03:00
|
|
|
add_library(testExe2libImp SHARED testExe2libImp.c)
|
2008-02-01 17:57:47 +03:00
|
|
|
set_property(TARGET testExe2libImp PROPERTY LIBRARY_OUTPUT_DIRECTORY impl)
|
2008-01-31 01:26:09 +03:00
|
|
|
add_library(testExe2lib SHARED testExe2lib.c)
|
|
|
|
target_link_libraries(testExe2lib testExe2libImp)
|
|
|
|
set_property(TARGET testExe2lib PROPERTY LINK_INTERFACE_LIBRARIES "")
|
2008-01-28 16:40:21 +03:00
|
|
|
add_executable(testExe2 testExe2.c)
|
|
|
|
set_property(TARGET testExe2 PROPERTY ENABLE_EXPORTS 1)
|
2008-01-31 01:26:09 +03:00
|
|
|
set_property(TARGET testExe2 PROPERTY LINK_INTERFACE_LIBRARIES testExe2lib)
|
2008-01-28 16:40:21 +03:00
|
|
|
|
|
|
|
add_library(testLib1 STATIC testLib1.c)
|
|
|
|
add_library(testLib2 STATIC testLib2.c)
|
|
|
|
target_link_libraries(testLib2 testLib1)
|
|
|
|
|
2008-01-31 01:26:09 +03:00
|
|
|
add_library(testLib3Imp SHARED testLib3Imp.c)
|
2008-02-01 17:57:47 +03:00
|
|
|
set_property(TARGET testLib3Imp PROPERTY LIBRARY_OUTPUT_DIRECTORY impl)
|
2008-01-28 16:40:21 +03:00
|
|
|
add_library(testLib3 SHARED testLib3.c)
|
2008-01-31 01:26:09 +03:00
|
|
|
target_link_libraries(testLib3 testLib3Imp)
|
|
|
|
set_property(TARGET testLib3 PROPERTY LINK_INTERFACE_LIBRARIES "")
|
2008-02-06 22:20:36 +03:00
|
|
|
set_property(TARGET testLib3 PROPERTY VERSION 1.2)
|
|
|
|
set_property(TARGET testLib3 PROPERTY SOVERSION 3)
|
2008-01-28 16:40:21 +03:00
|
|
|
|
2008-01-28 21:06:17 +03:00
|
|
|
add_library(testLib4 SHARED testLib4.c)
|
|
|
|
set_property(TARGET testLib4 PROPERTY FRAMEWORK 1)
|
|
|
|
|
2008-01-28 22:46:16 +03:00
|
|
|
add_executable(testExe3 testExe3.c)
|
|
|
|
set_property(TARGET testExe3 PROPERTY MACOSX_BUNDLE 1)
|
|
|
|
|
2008-01-28 16:40:21 +03:00
|
|
|
# Install and export from install tree.
|
2008-02-01 17:57:47 +03:00
|
|
|
install(
|
|
|
|
TARGETS
|
2008-01-31 23:45:31 +03:00
|
|
|
testExe1 testLib1 testLib2 testExe2 testLib3 testLib4 testExe3
|
|
|
|
testExe2lib
|
2008-01-28 16:40:21 +03:00
|
|
|
EXPORT exp
|
|
|
|
RUNTIME DESTINATION bin
|
2008-02-06 22:20:36 +03:00
|
|
|
LIBRARY DESTINATION lib NAMELINK_SKIP
|
2008-01-28 16:40:21 +03:00
|
|
|
ARCHIVE DESTINATION lib
|
2008-01-28 21:06:17 +03:00
|
|
|
FRAMEWORK DESTINATION Frameworks
|
2008-01-28 22:46:16 +03:00
|
|
|
BUNDLE DESTINATION Applications
|
2008-01-28 16:40:21 +03:00
|
|
|
)
|
2008-02-01 21:08:12 +03:00
|
|
|
install(
|
|
|
|
TARGETS
|
|
|
|
testExe2libImp testLib3Imp
|
|
|
|
EXPORT exp
|
|
|
|
RUNTIME DESTINATION bin
|
|
|
|
LIBRARY DESTINATION lib/impl
|
|
|
|
ARCHIVE DESTINATION lib/impl
|
|
|
|
)
|
2008-01-28 16:40:21 +03:00
|
|
|
install(EXPORT exp NAMESPACE exp_ DESTINATION lib/exp)
|
|
|
|
|
|
|
|
# Export from build tree.
|
2008-01-31 01:26:09 +03:00
|
|
|
export(TARGETS testExe1 testLib1 testLib2 testLib3
|
2008-01-31 23:45:31 +03:00
|
|
|
testExe2libImp testLib3Imp
|
2008-01-28 16:40:21 +03:00
|
|
|
NAMESPACE bld_
|
|
|
|
FILE ExportBuildTree.cmake
|
|
|
|
)
|
2008-01-31 01:26:09 +03:00
|
|
|
export(TARGETS testExe2 testLib4 testExe3 testExe2lib
|
2008-01-28 21:21:42 +03:00
|
|
|
NAMESPACE bld_
|
|
|
|
APPEND FILE ExportBuildTree.cmake
|
|
|
|
)
|