diff options
author | Brad King <brad.king@kitware.com> | 2007-04-17 17:43:03 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2007-04-17 17:43:03 (GMT) |
commit | aabcf981e22a7c39bcd828bff1a4fb4345e658c9 (patch) | |
tree | 1f166f92adf72e9008bff112099dbf1e5b61d7bf /Tests/Plugin/CMakeLists.txt | |
parent | c50dabff029b4ea5cd639189d822e3fc76a9e719 (diff) | |
download | CMake-aabcf981e22a7c39bcd828bff1a4fb4345e658c9.zip CMake-aabcf981e22a7c39bcd828bff1a4fb4345e658c9.tar.gz CMake-aabcf981e22a7c39bcd828bff1a4fb4345e658c9.tar.bz2 |
ENH: Added test for executables with plugins that use an API exported by the executable itself.
Diffstat (limited to 'Tests/Plugin/CMakeLists.txt')
-rw-r--r-- | Tests/Plugin/CMakeLists.txt | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/Tests/Plugin/CMakeLists.txt b/Tests/Plugin/CMakeLists.txt new file mode 100644 index 0000000..41fd05f --- /dev/null +++ b/Tests/Plugin/CMakeLists.txt @@ -0,0 +1,34 @@ +PROJECT(Plugin) + +# Test per-target output directory properties. +SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${Plugin_BINARY_DIR}/bin) +SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${Plugin_BINARY_DIR}/lib/plugin) +SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${Plugin_BINARY_DIR}/lib/static) + +# We need the dynamic loader support from KWSys to load the plugin in +# the executable. +SET(KWSYS_NAMESPACE kwsys) +SET(KWSYS_HEADER_ROOT ${Plugin_BINARY_DIR}/include) +SET(KWSYS_USE_DynamicLoader 1) +ADD_SUBDIRECTORY(${Plugin_SOURCE_DIR}/../../Source/kwsys src/kwsys) +INCLUDE_DIRECTORIES( + ${Plugin_BINARY_DIR}/include + ${Plugin_SOURCE_DIR}/include + ) + +# Create an executable that exports an API for use by plugins. +ADD_EXECUTABLE(example_exe src/example_exe.cxx) +SET_TARGET_PROPERTIES(example_exe PROPERTIES + ENABLE_EXPORTS 1 + OUTPUT_NAME example + ) +TARGET_LINK_LIBRARIES(example_exe kwsys) + +# Create a plugin that uses the API provided by the executable. +# This module "links" to the executable to use the symbols. +ADD_LIBRARY(example_mod_1 MODULE src/example_mod_1.c) +TARGET_LINK_LIBRARIES(example_mod_1 example_exe) + +# TODO: +# - create a plugin that links to a static lib +# - create a plugin that links to a shared lib |