diff --git a/CMakeLists.txt b/CMakeLists.txt index b81ee3544a607d738d39b27ddaf17c16ec7e13a9..4764bcc8f407e759a6b1759155e22da956b1f3d4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -160,9 +160,17 @@ if(DD4HEP_USE_HEPMC3) # Optional dependencies for compressed input support if(${HEPMC3_VERSION} VERSION_GREATER_EQUAL "3.02.05") - find_package(ZLIB) - find_package(LibLZMA) - find_package(BZip2) + option(DD4HEP_HEPMC3_COMPRESSION_SUPPORT "Enable reading of compressed HepMC files" ON) + if(${DD4HEP_HEPMC3_COMPRESSION_SUPPORT}) + find_package(ZLIB REQUIRED) + find_package(LibLZMA REQUIRED) + find_package(BZip2 REQUIRED) + endif() + else() + option(DD4HEP_HEPMC3_COMPRESSION_SUPPORT "Enable reading of compressed HepMC files" OFF) + if(${DD4HEP_HEPMC3_COMPRESSION_SUPPORT}) + message(FATAL "HepMC3 v3.2.5 is required for -DDD4HEP_HEPMC3_COMPRESSION_SUPPORT=ON") + endif() endif() endif() diff --git a/DDTest/CMakeLists.txt b/DDTest/CMakeLists.txt index e58dbdb833404dd496b819c609b5fa321e1f03f9..a2b7d56ff0d2e1e9aab229a92871301a76621315 100644 --- a/DDTest/CMakeLists.txt +++ b/DDTest/CMakeLists.txt @@ -60,31 +60,25 @@ if (DD4HEP_USE_GEANT4) if(DD4HEP_USE_HEPMC3) set(TEST_HEPMC3_EXTENSIONS) - if(${HEPMC3_VERSION} VERSION_GREATER_EQUAL "3.02.05") - if(ZLIB_FOUND) - file(ARCHIVE_CREATE - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Pythia_output.hepmc.gz - PATHS ${CMAKE_CURRENT_SOURCE_DIR}/inputFiles/Pythia_output.hepmc - FORMAT raw - COMPRESSION GZip) - list(APPEND TEST_HEPMC3_EXTENSIONS .gz) - endif() - if(LIBLZMA_FOUND) - file(ARCHIVE_CREATE - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Pythia_output.hepmc.xz - PATHS ${CMAKE_CURRENT_SOURCE_DIR}/inputFiles/Pythia_output.hepmc - FORMAT raw - COMPRESSION XZ) - list(APPEND TEST_HEPMC3_EXTENSIONS .xz) - endif() - if(BZIP2_FOUND) - file(ARCHIVE_CREATE - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Pythia_output.hepmc.bz2 - PATHS ${CMAKE_CURRENT_SOURCE_DIR}/inputFiles/Pythia_output.hepmc - FORMAT raw - COMPRESSION BZip2) - list(APPEND TEST_HEPMC3_EXTENSIONS .bz2) - endif() + if(${DD4HEP_HEPMC3_COMPRESSION_SUPPORT}) + file(ARCHIVE_CREATE + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Pythia_output.hepmc.gz + PATHS ${CMAKE_CURRENT_SOURCE_DIR}/inputFiles/Pythia_output.hepmc + FORMAT raw + COMPRESSION GZip) + list(APPEND TEST_HEPMC3_EXTENSIONS .gz) + file(ARCHIVE_CREATE + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Pythia_output.hepmc.xz + PATHS ${CMAKE_CURRENT_SOURCE_DIR}/inputFiles/Pythia_output.hepmc + FORMAT raw + COMPRESSION XZ) + list(APPEND TEST_HEPMC3_EXTENSIONS .xz) + file(ARCHIVE_CREATE + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Pythia_output.hepmc.bz2 + PATHS ${CMAKE_CURRENT_SOURCE_DIR}/inputFiles/Pythia_output.hepmc + FORMAT raw + COMPRESSION BZip2) + list(APPEND TEST_HEPMC3_EXTENSIONS .bz2) endif() foreach(TEST_HEPMC3_EXTENSION "" ${TEST_HEPMC3_EXTENSIONS})