Skip to content
Snippets Groups Projects
Commit 83f8e405 authored by Giacomo Strangolino's avatar Giacomo Strangolino
Browse files

cmake

parent 08e66e3c
No related branches found
No related tags found
No related merge requests found
......@@ -4,10 +4,9 @@ project(cumbia-tango VERSION 2.2.1
DESCRIPTION "C++ library based on cumbia and the Tango control system"
LANGUAGES CXX)
find_package(cumbia 2.0 REQUIRED)
find_package(cumbia 2.2 REQUIRED)
include(FindPkgConfig)
#set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_CURRENT_SOURCE_DIR}/cmake")
pkg_check_modules(TANGO_DEPENDENCY REQUIRED tango)
# Include directories and compile flags from the dependency
......@@ -18,6 +17,9 @@ add_definitions(${TANGO_DEPENDENCY_CFLAGS_OTHER})
# to have CMAKE_INSTALL_INCLUDEDIR CMAKE_INSTALL_LIBDIR
include(GNUInstallDirs)
# Modify CMAKE_INSTALL_INCLUDEDIR to include the library name
set(CMAKE_INSTALL_INCLUDEDIR "include/${PROJECT_NAME}")
file(GLOB_RECURSE SOURCES lib/*.cpp)
file(GLOB_RECURSE HEADERS lib/*.h)
......@@ -29,17 +31,13 @@ target_link_libraries(cumbia-tango PUBLIC tango)
# in order to have lib and symlinks
set_target_properties(cumbia-tango PROPERTIES VERSION ${PROJECT_VERSION})
set_target_properties(cumbia-tango PROPERTIES SOVERSION ${PROJECT_VERSION_MAJOR})
set_target_properties(cumbia-tango PROPERTIES PUBLIC_HEADER "${HEADERS}" )
set_target_properties(cumbia-tango
PROPERTIES
PUBLIC_HEADER "${HEADERS}"
)
target_compile_features(cumbia-tango PUBLIC cxx_std_17)
target_compile_features(cumbia-tango PRIVATE cxx_std_17)
target_include_directories(cumbia-tango PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/lib>
$<INSTALL_INTERFACE:include/cumbia-tango> # <prefix>/include/cumbia-tango
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)
target_compile_definitions(cumbia-tango PRIVATE
......@@ -51,7 +49,7 @@ configure_file(lib/cumbia-tango.pc.cmake.in cumbia-tango.pc @ONLY)
install(TARGETS cumbia-tango EXPORT cumbia-tangoTargets
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/cumbia-tango)
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
# install pkgconfig file
install(
......@@ -61,7 +59,9 @@ install(
export(TARGETS cumbia-tango FILE cumbia-tangoTargets.cmake)
set(CMAKE_EXPORT_PACKAGE_REGISTRY ON)
# this writes a registry entry under the user .cmake/packages
# directory, pointing to the source tree/build directory
## set(CMAKE_EXPORT_PACKAGE_REGISTRY ON)
export(PACKAGE cumbia-tango)
install(EXPORT cumbia-tangoTargets
FILE cumbia-tangoTargets.cmake
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment