CMakeLists.txt 3.18 KB
Newer Older
1
# list of source files
2 3 4 5 6 7
set(hepnos-src DataStore.cpp
	       DataSet.cpp
	       RunSet.cpp
	       Run.cpp
	       SubRun.cpp
	       Event.cpp) 
8

9
set(hepnos-service-src service/HEPnOSService.cpp
Matthieu Dorier's avatar
Matthieu Dorier committed
10 11
		       service/ServiceConfig.cpp
		       service/ConnectionInfoGenerator.cpp)
12

13 14 15 16 17 18 19 20 21
# 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).
#
22 23
set (HEPNOS_VERSION_MAJOR 0)
set (HEPNOS_VERSION_MINOR 1)
24
set (HEPNOS_VERSION_PATCH 2)
25 26 27
set (hepnos-vers "${HEPNOS_VERSION_MAJOR}.${HEPNOS_VERSION_MINOR}")
set (HEPNOS_VERSION "${hepnos-vers}.${HEPNOS_VERSION_PATCH}")

28 29 30
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>)
31 32

# local include's BEFORE, in case old incompatable .h files in prefix/include
33 34 35
include_directories (hepnos ${CMAKE_CURRENT_SOURCE_DIR}/private)
target_include_directories (hepnos BEFORE PUBLIC
    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>)
36 37

# for shared libs, establish the lib version
38 39 40
set_target_properties (hepnos
    PROPERTIES VERSION ${HEPNOS_VERSION}
    SOVERSION ${HEPNOS_VERSION_MAJOR})
41

42 43 44 45 46 47 48
add_library(hepnos-service ${hepnos-service-src})
target_link_libraries (hepnos mercury margo yaml-cpp sdskv-client sdskv-server bake-client bake-server ch-placement)
target_include_directories (hepnos-service PUBLIC $<INSTALL_INTERFACE:include>)

# local include's BEFORE, in case old incompatable .h files in prefix/include
target_include_directories (hepnos-service BEFORE PUBLIC
    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>)
49 50
target_include_directories (hepnos-service BEFORE PUBLIC
    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/service>)
51 52 53 54 55

# for shared libs, establish the lib version
set_target_properties (hepnos-service
    PROPERTIES VERSION ${HEPNOS_VERSION}
    SOVERSION ${HEPNOS_VERSION_MAJOR})
56 57 58 59 60 61 62 63 64 65 66 67 68 69
#
# 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
#
70 71 72 73 74 75 76
install (TARGETS hepnos EXPORT hepnos-targets
         ARCHIVE DESTINATION lib
         LIBRARY DESTINATION lib)
install (TARGETS hepnos-service ARCHIVE DESTINATION lib LIBRARY DESTINATION lib)
install (EXPORT hepnos-targets
         DESTINATION ${hepnos-pkg}
         FILE "hepnos-targets.cmake")
77 78 79 80 81 82
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
83
         FILES_MATCHING PATTERN "*.hpp")
84 85 86
install (DIRECTORY ../include/hepnos
         DESTINATION include
         FILES_MATCHING PATTERN "*.h")
Matthieu Dorier's avatar
Matthieu Dorier committed
87
install (FILES ../include/hepnos.hpp
88 89 90
		DESTINATION include)
install (FILES ../include/hepnos-service.h
		DESTINATION include)