Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/workflows/key4hep.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,10 @@ jobs:
make -k
make install
ctest --output-on-failure
echo "::group::Test downstream build"
cd -
export CMAKE_PREFIX_PATH=$PWD/install:$CMAKE_PREFIX_PATH
cd tests/downstream-project-cmake-test
mkdir build && cd build
cmake .. -DCMAKE_CXX_STANDARD=17
make -k
7 changes: 7 additions & 0 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,10 @@ jobs:
make -k
make install
ctest --output-on-failure
echo "::group::Test downstream build"
cd -
export CMAKE_PREFIX_PATH=$PWD/install:$CMAKE_PREFIX_PATH
cd tests/downstream-project-cmake-test
mkdir build && cd build
cmake .. -DCMAKE_CXX_STANDARD=17
make -k
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ eval $*

ENDIF()

# Deal with SIO
FIND_PACKAGE( SIO QUIET )
# Deal with SIO (we need at least 0.1 since there are no targets before)
FIND_PACKAGE( SIO 0.1 QUIET )

IF( NOT SIO_FOUND )
MESSAGE( STATUS "SIO not found on your system. Using builtin sio" )
Expand Down
7 changes: 1 addition & 6 deletions cmake/LCIOConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,7 @@ CHECK_PACKAGE_LIBS( LCIO lcio @CHECK_PACKAGE_SIO_LIBRARY@ )


include(CMakeFindDependencyMacro)
if("@CHECK_PACKAGE_SIO_LIBRARY@" STREQUAL "")
find_dependency(SIO REQUIRED)
else()
find_dependency(ZLIB REQUIRED)
include("${CMAKE_CURRENT_LIST_DIR}/SIOTargets.cmake")
endif()
find_dependency(SIO @SIO_VERSION@)

# Include the targets file to create the imported targets that a client can link
# to or execute
Expand Down
15 changes: 15 additions & 0 deletions tests/downstream-project-cmake-test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
22 changes: 22 additions & 0 deletions tests/downstream-project-cmake-test/lcio_test_program.cpp
Original file line number Diff line number Diff line change
@@ -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;
}