Skip to content

Commit

Permalink
Added options for static
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrii Verbytskyi committed Oct 17, 2024
1 parent f0776f3 commit 6a03149
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 6 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
21 changes: 16 additions & 5 deletions HepMC3-config.in
Original file line number Diff line number Diff line change
Expand Up @@ -69,35 +69,46 @@ 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

if [[ "@HEPMC3_FEATURES@" == *search* ]]; then
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

if [[ "@HEPMC3_FEATURES@" == *protobufIO* ]]; then
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

if [[ "@HEPMC3_FEATURES@" == *search* ]]; then
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

if [[ "@HEPMC3_FEATURES@" == *protobufIO* ]]; then
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

if [[ "@HEPMC3_FEATURES@" == *rootIO* ]]; then
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
Expand Down

0 comments on commit 6a03149

Please sign in to comment.