1 cmake_minimum_required (VERSION 2.6)
4 # Test per-target output directory properties.
5 SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${Plugin_BINARY_DIR}/bin)
6 SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${Plugin_BINARY_DIR}/lib/plugin)
7 SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${Plugin_BINARY_DIR}/lib/static)
9 # We need ansi C support.
11 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_ANSI_CFLAGS}")
12 ENDIF(CMAKE_ANSI_CFLAGS)
14 # We need the dynamic loader support from KWSys to load the plugin in
16 SET(KWSYS_NAMESPACE kwsys)
17 SET(KWSYS_HEADER_ROOT ${Plugin_BINARY_DIR}/include)
18 SET(KWSYS_USE_DynamicLoader 1)
19 ADD_SUBDIRECTORY(${Plugin_SOURCE_DIR}/../../Source/kwsys src/kwsys)
21 # Configure the location of plugins.
22 CONFIGURE_FILE(${Plugin_SOURCE_DIR}/src/example_exe.h.in
23 ${Plugin_BINARY_DIR}/include/example_exe.h @ONLY)
25 # We need to include headers from the source tree and configured
26 # headers in the build tree.
28 ${Plugin_BINARY_DIR}/include
29 ${Plugin_SOURCE_DIR}/include
32 # Create an executable that exports an API for use by plugins.
33 ADD_EXECUTABLE(example_exe src/example_exe.cxx)
34 SET_TARGET_PROPERTIES(example_exe PROPERTIES
38 TARGET_LINK_LIBRARIES(example_exe kwsys)
40 # Create a plugin that uses the API provided by the executable.
41 # This module "links" to the executable to use the symbols.
42 ADD_LIBRARY(example_mod_1 MODULE src/example_mod_1.c)
43 TARGET_LINK_LIBRARIES(example_mod_1 example_exe)
46 # - create a plugin that links to a static lib
47 # - create a plugin that links to a shared lib