CMakeLists.txt             |    5 +++++
 examples/CMakeLists.txt    |    3 +++
 examples/qt/CMakeLists.txt |   21 +++++++++++++++++++++
 3 files changed, 29 insertions(+)

New commits:
commit 9d8fffbf39ece34d1d4fb315beac1f8967a12bbe
Author: Bernhard Sessler <bernh...@burnsen.de>
Date:   Sun Dec 22 15:22:28 2013 +0100

    examples: Add Qt test runner example to CMake build system
    
    The new CMake build option 'CPPUNIT_BUILD_EXAMPLES' (OFF by default)
    decides whether to build the example programs or not.
    
    Change-Id: I6694f224bcf9c0c5131c9a1810c6565ad91626b7
    Signed-off-by: Bernhard Sessler <bernh...@burnsen.de>
    Reviewed-on: https://gerrit.libreoffice.org/7185
    Reviewed-by: Markus Mohrhard <markus.mohrh...@googlemail.com>
    Tested-by: Markus Mohrhard <markus.mohrh...@googlemail.com>

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0427289..3e6c407 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -18,6 +18,7 @@ include(Versioning)
 option(BUILD_SHARED_LIBS           "Build cppunit as shared or static library" 
               ON)
 option(CPPUNIT_BUILD_APIDOC        "Adds a build target for generating the API 
documentation" OFF)
 option(CPPUNIT_BUILD_QT_TESTRUNNER "Build the Qt test runner library"          
               OFF)
+option(CPPUNIT_BUILD_EXAMPLES      "Build the examples shipped with cppunit"   
               OFF)
 
 if(BUILD_SHARED_LIBS AND WIN32)
     add_definitions(-DCPPUNIT_BUILD_DLL)
@@ -35,6 +36,10 @@ include_directories("${CMAKE_CURRENT_BINARY_DIR}/include")
 add_subdirectory(include)
 add_subdirectory(src)
 
+if(CPPUNIT_BUILD_EXAMPLES)
+    add_subdirectory(examples)
+endif()
+
 if(CPPUNIT_BUILD_APIDOC)
     add_subdirectory(doc)
 endif()
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
new file mode 100644
index 0000000..0c26262
--- /dev/null
+++ b/examples/CMakeLists.txt
@@ -0,0 +1,3 @@
+if(CPPUNIT_BUILD_QT_TESTRUNNER)
+    add_subdirectory(qt)
+endif()
diff --git a/examples/qt/CMakeLists.txt b/examples/qt/CMakeLists.txt
new file mode 100644
index 0000000..ea9d142
--- /dev/null
+++ b/examples/qt/CMakeLists.txt
@@ -0,0 +1,21 @@
+# Include the current binary dir, so files produced by moc can be found
+include_directories(${CMAKE_CURRENT_BINARY_DIR})
+
+# Common source files
+set(qt_example_SOURCES
+    ExampleTestCases.cpp
+    Main.cpp
+)
+
+# Create the test runner executable
+add_executable(qt_example ${qt_example_SOURCES})
+target_link_libraries(qt_example cppunit-qttestrunner)
+
+if(Qt5_POSITION_INDEPENDENT_CODE)
+    set_target_properties(qt_example PROPERTIES POSITION_INDEPENDENT_CODE ON)
+endif()
+
+# Create install target
+install(TARGETS qt_example
+    RUNTIME DESTINATION bin
+    COMPONENT examples)
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to