summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernhard Sessler <bernhard.sessler@corscience.de>2014-01-08 14:38:07 +0100
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2014-01-11 16:04:19 +0000
commit5c300a093a72e808751ff69508f7e92889474d64 (patch)
treefb0598af94b99ae6ca34e0c327cff399e12a4176
parent78b0923b6ae906753a843956a7b187df60dee595 (diff)
downloadcppunit-5c300a093a72e808751ff69508f7e92889474d64.tar.gz
examples/cppunittest: Add to CMake build system
This patch adds support for building the cppunittest executable and plugin with the CMake build system Change-Id: I4fe90657a4f74a1a96650ebdf176d2b2b8884c9c Signed-off-by: Bernhard Sessler <bernhard.sessler@corscience.de> Reviewed-on: https://gerrit.libreoffice.org/7315 Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com> Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
-rw-r--r--CMakeLists.txt1
-rw-r--r--examples/CMakeLists.txt2
-rw-r--r--examples/cppunittest/CMakeLists.txt53
3 files changed, 56 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b545035..c57daea 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -4,6 +4,7 @@ cmake_minimum_required(VERSION 2.8.7)
# Add project specific CMake module path
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
+set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index 0c26262..5bf007b 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -1,3 +1,5 @@
+add_subdirectory(cppunittest)
+
if(CPPUNIT_BUILD_QT_TESTRUNNER)
add_subdirectory(qt)
endif()
diff --git a/examples/cppunittest/CMakeLists.txt b/examples/cppunittest/CMakeLists.txt
new file mode 100644
index 0000000..f41d46e
--- /dev/null
+++ b/examples/cppunittest/CMakeLists.txt
@@ -0,0 +1,53 @@
+# Common source files
+set(cppunit-test-objlib_SOURCES
+ assertion_traitsTest.cpp
+ BaseTestCase.cpp
+ CppUnitTestSuite.cpp
+ ExceptionTestCaseDecoratorTest.cpp
+ ExceptionTest.cpp
+ HelperMacrosTest.cpp
+ MessageTest.cpp
+ MockTestCase.cpp
+ MockTestListener.cpp
+ OrthodoxTest.cpp
+ RepeatedTestTest.cpp
+ StringToolsTest.cpp
+ SubclassedTestCase.cpp
+ TestAssertTest.cpp
+ TestCallerTest.cpp
+ TestCaseTest.cpp
+ TestDecoratorTest.cpp
+ TestFailureTest.cpp
+ TestPathTest.cpp
+ TestResultCollectorTest.cpp
+ TestResultTest.cpp
+ TestSetUpTest.cpp
+ TestSuiteTest.cpp
+ TestTest.cpp
+ TrackedTestCase.cpp
+ XmlElementTest.cpp
+ XmlOutputterTest.cpp
+ XmlUniformiser.cpp
+ XmlUniformiserTest.cpp
+)
+
+# Create a common object library
+add_library(cppunit-test-objlib OBJECT ${cppunit-test-objlib_SOURCES})
+
+# Create the test executable
+add_executable(cppunit-test-bin CppUnitTestMain.cpp $<TARGET_OBJECTS:cppunit-test-objlib>)
+target_link_libraries(cppunit-test-bin cppunit)
+if(CPPUNIT_BUILD_TESTING)
+ add_test(NAME cppunit-test-bin COMMAND cppunit-test-bin)
+endif()
+
+# Create the test plugin
+add_library(cppunit-test-plugin MODULE CppUnitTestPlugIn.cpp $<TARGET_OBJECTS:cppunit-test-objlib>)
+target_link_libraries(cppunit-test-plugin cppunit)
+
+# Create install target
+install(TARGETS cppunit-test-bin
+ DESTINATION share/${CPPUNIT_VERSION}/examples COMPONENT examples)
+
+install(TARGETS cppunit-test-plugin
+ DESTINATION share/${CPPUNIT_VERSION}/examples COMPONENT examples)