adds install target for cmake builds

Fri, 27 Dec 2019 11:48:55 +0100

author
Mike Becker <universe@uap-core.de>
date
Fri, 27 Dec 2019 11:48:55 +0100
changeset 377
2099a3aff61e
parent 376
028039652b86
child 378
952c2df7e7ac

adds install target for cmake builds

CMakeLists.txt file | annotate | diff | comparison | revisions
src/CMakeLists.txt file | annotate | diff | comparison | revisions
--- a/CMakeLists.txt	Fri Dec 20 14:44:50 2019 +0100
+++ b/CMakeLists.txt	Fri Dec 27 11:48:55 2019 +0100
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.15)
+cmake_minimum_required(VERSION 3.10)
 project(ucx VERSION 2.1 DESCRIPTION "UAP Common Extensions")
 
 # Configuration
--- a/src/CMakeLists.txt	Fri Dec 20 14:44:50 2019 +0100
+++ b/src/CMakeLists.txt	Fri Dec 27 11:48:55 2019 +0100
@@ -14,6 +14,22 @@
         ucx.c
         utils.c
 )
+set(headers
+        ucx/allocator.h
+        ucx/array.h
+        ucx/avl.h
+        ucx/buffer.h
+        ucx/list.h
+        ucx/logging.h
+        ucx/map.h
+        ucx/mempool.h
+        ucx/properties.h
+        ucx/stack.h
+        ucx/string.h
+        ucx/test.h
+        ucx/ucx.h
+        ucx/utils.h
+)
 
 add_library(ucx SHARED ${sources})
 add_library(ucx_static STATIC ${sources})
@@ -23,3 +39,12 @@
 
 set_target_properties(ucx PROPERTIES SOVERSION 3 VERSION 3.1.0)
 set_target_properties(ucx_static PROPERTIES VERSION ${CMAKE_PROJECT_VERSION})
+
+# it is sufficient to specify the headers for one of the targets
+set_target_properties(ucx PROPERTIES PUBLIC_HEADER "${headers}")
+
+include(GNUInstallDirs)
+install(TARGETS ucx ucx_static
+        LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+        ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+        PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/ucx)
\ No newline at end of file

mercurial