Skip to content

Commit

Permalink
Merge branch 'fixconfig' into 'master'
Browse files Browse the repository at this point in the history
Fix the HepMC3-config

Closes #96

See merge request hepmc/HepMC3!365
  • Loading branch information
Andrii Verbytskyi committed Nov 29, 2024
2 parents d4ee80c + b1ba234 commit e35bc36
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
11 changes: 10 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,10 @@ include(CheckCXXCompilerFlag)
if (NOT HEPMC3_CXX_STANDARD)
set(HEPMC3_CXX_STANDARD 11)
endif()
set(HEPMC3_FEATURES "")
set(HEPMC3_FEATURES "lib")
if (HEPMC3_BUILD_STATIC_LIBS)
list(APPEND HEPMC3_FEATURES "lib_static")
endif()
set(HEPMC3_COMPONENTS "")
if(HEPMC3_ENABLE_ROOTIO)
list(APPEND CMAKE_PREFIX_PATH $ENV{ROOTSYS})
Expand Down Expand Up @@ -282,6 +285,9 @@ set(INTERFACES_INSTALL_DIR ${CMAKE_INSTALL_DATADIR}/HepMC3/interfaces)
if(HEPMC3_ENABLE_SEARCH)
add_subdirectory(search)
list(APPEND HEPMC3_FEATURES "search")
if (HEPMC3_BUILD_STATIC_LIBS)
list(APPEND HEPMC3_FEATURES "search_static")
endif()
list(APPEND HEPMC3_COMPONENTS "search")
endif()

Expand All @@ -304,6 +310,9 @@ if(Protobuf_FOUND)
add_subdirectory(protobufIO)
list(APPEND HEPMC3_FEATURES "protobufIO")
list(APPEND HEPMC3_FEATURES "protobufIO${Protobuf_VERSION}")
if (HEPMC3_BUILD_STATIC_LIBS)
list(APPEND HEPMC3_FEATURES "protobufIO_static")
endif()
list(APPEND HEPMC3_COMPONENTS "protobufIO")
endif()

Expand Down
22 changes: 21 additions & 1 deletion HepMC3-config.in
Original file line number Diff line number Diff line change
Expand Up @@ -69,29 +69,49 @@ test -n "$tmp" && OUT="$OUT -I@PACKAGE_CMAKE_INSTALL_INCLUDEDIR@"
tmp=$( echo "$*" | egrep -- '--\<static\>')
if test -n "$tmp"; then

st=$( echo "@HEPMC3_FEATURES@" | egrep -w -- 'lib_static')
test -n "$st"; then
tmp=$( echo "$*" | egrep -- '--\<ldflags|libs\>')
OUT="$OUT @PACKAGE_CMAKE_INSTALL_LIBDIR@/libHepMC3-static.a"
fi

st=$( echo "@HEPMC3_FEATURES@" | egrep -w -- 'search_static')
test -n "$st"; then
tmp=$( echo "$*" | egrep -- '--\<search\>')
test -n "$tmp" && OUT="$OUT @PACKAGE_CMAKE_INSTALL_LIBDIR@/libHepMC3search-static.a"
fi

st=$( echo "@HEPMC3_FEATURES@" | egrep -w -- 'protobufIO_static')
test -n "$st"; then
tmp=$( echo "$*" | egrep -- '--\<protobufIO\>')
test -n "$tmp" && OUT="$OUT @PACKAGE_CMAKE_INSTALL_LIBDIR@/libHepMC3protobufIO_static.a"
fi

else

st=$( echo "@HEPMC3_FEATURES@" | egrep -w -- 'lib')
test -n "$st"; then
tmp=$( echo "$*" | egrep -- '--\<ldflags|libs\>')
test -n "$tmp" && OUT="$OUT -L@PACKAGE_CMAKE_INSTALL_LIBDIR@ -lHepMC3"
fi

st=$( echo "@HEPMC3_FEATURES@" | egrep -w -- 'search')
test -n "$st"; then
tmp=$( echo "$*" | egrep -- '--\<search\>')
test -n "$tmp" && OUT="$OUT -L@PACKAGE_CMAKE_INSTALL_LIBDIR@ -lHepMC3search"
fi

st=$( echo "@HEPMC3_FEATURES@" | egrep -w -- 'protobufIO')
test -n "$st"; then
tmp=$( echo "$*" | egrep -- '--\<protobufIO\>')
test -n "$tmp" && OUT="$OUT -L@PACKAGE_CMAKE_INSTALL_LIBDIR@ -lHepMC3protobufIO"
fi

st=$( echo "@HEPMC3_FEATURES@" | egrep -w -- 'rootIO')
test -n "$st"; then
tmp=$( echo "$*" | egrep -- '--\<rootIO\>')
test -n "$tmp" && OUT="$OUT -L@PACKAGE_HEPMC3_ROOTIO_INSTALL_LIBDIR@ -lHepMC3rootIO"

fi
fi

tmp=$( echo "$*" | egrep -- '--\<features\>')
Expand Down

0 comments on commit e35bc36

Please sign in to comment.