From 1148219311dbf4d8ef35d76467b82c03c6b52d6e Mon Sep 17 00:00:00 2001 From: tmadlener Date: Thu, 11 Jan 2024 10:36:19 +0100 Subject: [PATCH] Add a small downstream project for testing --- .../CMakeLists.txt | 15 +++++++++++++ .../lcio_test_program.cpp | 22 +++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 tests/downstream-project-cmake-test/CMakeLists.txt create mode 100644 tests/downstream-project-cmake-test/lcio_test_program.cpp diff --git a/tests/downstream-project-cmake-test/CMakeLists.txt b/tests/downstream-project-cmake-test/CMakeLists.txt new file mode 100644 index 000000000..77f70f5c2 --- /dev/null +++ b/tests/downstream-project-cmake-test/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.14) + +project(DownstreamProjectUsingLCIO) + +find_package(LCIO REQUIRED) + +# Make sure that the LCIO version is set and usableas a version +if (${LCIO_VERSION} VERSION_GREATER "0.0.0") + message(STATUS "Found LCIO version " ${LCIO_VERSION}) +else() + message(FATAL_ERROR "Cannot determine LCIO_VERSION") +endif() + +add_executable(lcio_test_program lcio_test_program.cpp) +target_link_libraries(lcio_test_program PRIVATE LCIO::lcio) diff --git a/tests/downstream-project-cmake-test/lcio_test_program.cpp b/tests/downstream-project-cmake-test/lcio_test_program.cpp new file mode 100644 index 000000000..a53be69fa --- /dev/null +++ b/tests/downstream-project-cmake-test/lcio_test_program.cpp @@ -0,0 +1,22 @@ +#include "EVENT/LCEvent.h" +#include "IMPL/LCCollectionVec.h" +#include "IMPL/LCEventImpl.h" +#include "IMPL/MCParticleImpl.h" +#include "MT/LCWriter.h" + +int main() { + auto mcp = new IMPL::MCParticleImpl(); + mcp->setPDG(11); + + auto coll = new IMPL::LCCollectionVec(EVENT::LCIO::MCPARTICLE); + coll->addElement(mcp); + + auto event = new IMPL::LCEventImpl(); + event->addCollection(coll, "mcps"); + + auto writer = MT::LCWriter(); + writer.open("test.slcio"); + writer.writeEvent(event); + + return 0; +}