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

# 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}")

19 20 21
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
22 23

# local include's BEFORE, in case old incompatable .h files in prefix/include
24 25 26
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
27 28

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

#
# 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
59
         FILES_MATCHING PATTERN "*.hpp")