CMakeLists.txt 2.04 KB
Newer Older
Matthieu Dorier's avatar
Matthieu Dorier committed
1
# list of source files
Matthieu Dorier's avatar
Matthieu Dorier committed
2 3 4 5 6 7
set(hepnos-src DataStore.cpp
	       DataSet.cpp
	       RunSet.cpp
	       Run.cpp
	       SubRun.cpp
	       Event.cpp) 
Matthieu Dorier's avatar
Matthieu Dorier committed
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23

# load package helper for generating cmake CONFIG packages
include (CMakePackageConfigHelpers)

# where to install files for "find_package"
set (hepnos-pkg "share/cmake/hepnos")

#
# library version set here (e.g. for shared libs).
#
set (HEPNOS_VERSION_MAJOR 1)
set (HEPNOS_VERSION_MINOR 0)
set (HEPNOS_VERSION_PATCH 0)
set (hepnos-vers "${HEPNOS_VERSION_MAJOR}.${HEPNOS_VERSION_MINOR}")
set (HEPNOS_VERSION "${hepnos-vers}.${HEPNOS_VERSION_PATCH}")

24 25 26
add_library(hepnos ${hepnos-src})
target_link_libraries (hepnos mercury margo yaml-cpp sdskv-client bake-client ch-placement)
target_include_directories (hepnos PUBLIC $<INSTALL_INTERFACE:include>)
Matthieu Dorier's avatar
Matthieu Dorier committed
27 28

# local include's BEFORE, in case old incompatable .h files in prefix/include
29 30 31
include_directories (hepnos ${CMAKE_CURRENT_SOURCE_DIR}/private)
target_include_directories (hepnos BEFORE PUBLIC
    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>)
Matthieu Dorier's avatar
Matthieu Dorier committed
32 33

# for shared libs, establish the lib version
34 35 36
set_target_properties (hepnos
    PROPERTIES VERSION ${HEPNOS_VERSION}
    SOVERSION ${HEPNOS_VERSION_MAJOR})
Matthieu Dorier's avatar
Matthieu Dorier committed
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63

#
# installation stuff (packaging and install commands)
#
write_basic_package_version_file(
    "hepnos-config-version.cmake"
    VERSION ${HEPNOS_VERSION}
    COMPATIBILITY AnyNewerVersion)

# generate our config file for find_package()
configure_file (hepnos-config.cmake.in hepnos-config.cmake @ONLY)

#
# "make install" rules
#
#install (TARGETS hepnos EXPORT hepnos-targets
#         ARCHIVE DESTINATION lib
#         LIBRARY DESTINATION lib)
#install (EXPORT hepnos-targets
#         DESTINATION ${hepnos-pkg}
#         FILE "hepnos-targets.cmake")
install (FILES "${CMAKE_CURRENT_BINARY_DIR}/hepnos-config.cmake"
               "${CMAKE_CURRENT_BINARY_DIR}/hepnos-config-version.cmake"
               "../cmake/xpkg-import.cmake"
         DESTINATION ${hepnos-pkg} )
install (DIRECTORY ../include/hepnos
         DESTINATION include
Matthieu Dorier's avatar
Matthieu Dorier committed
64
         FILES_MATCHING PATTERN "*.hpp")