Forráskód Böngészése

support 'make install' properly

Ioannis Koutras 12 éve
szülő
commit
b385383b1a

+ 3 - 0
CMakeLists.txt

@@ -2,8 +2,11 @@ project (dmmlib C)
 
 cmake_minimum_required (VERSION 2.6)
 
+set(APPLICATION_NAME ${PROJECT_NAME})
+
 set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules)
 
+include(DefineInstallationPaths)
 include(DefineOptions.cmake)
 
 include(MacroEnsureOutOfSourceBuild)

+ 9 - 0
cmake/Modules/DefineInstallationPaths.cmake

@@ -0,0 +1,9 @@
+SET(INCLUDE_INSTALL_DIR
+   "${CMAKE_INSTALL_PREFIX}/include"
+   CACHE PATH "The subdirectory to the header prefix (default prefix/include)"
+)
+
+SET(LIB_INSTALL_DIR
+  "${CMAKE_INSTALL_PREFIX}/lib"
+  CACHE PATH "The subdirectory relative to the install prefix where libraries will be installed (default is prefix/lib)"
+)

+ 5 - 2
include/dmmlib/CMakeLists.txt

@@ -1,9 +1,10 @@
 project(dmmlib-headers C)
 
 set(dmmlib_HDRS
+  allocator.h
   dmmlib.h
-  heap.h
-  initialize_allocator.h
+  dmmstats.h 
+  raw_block.h
 )
 
 install(
@@ -11,4 +12,6 @@ install(
     ${dmmlib_HDRS}
   DESTINATION
     ${INCLUDE_INSTALL_DIR}/${APPLICATION_NAME}
+  COMPONENT
+    headers
 )

+ 26 - 0
src/CMakeLists.txt

@@ -163,9 +163,35 @@ include_directories(
 
 if (WITH_SHARED_LIB)
   add_library(${DMMLIB_SHARED_LIBRARY} SHARED ${dmmlib_SRCS})
+
+  set_target_properties(
+    ${DMMLIB_SHARED_LIBRARY}
+      PROPERTIES
+        OUTPUT_NAME
+          dmm
+  )
+
+  install(
+    TARGETS
+      ${DMMLIB_SHARED_LIBRARY}
+    DESTINATION
+      ${LIB_INSTALL_DIR}
+    COMPONENT
+      libraries
+  )
 endif (WITH_SHARED_LIB)
 
 if (WITH_STATIC_LIB)
   add_library(${DMMLIB_STATIC_LIBRARY} STATIC ${dmmlib_SRCS})
+
+  install(
+    TARGETS
+      ${DMMLIB_STATIC_LIBRARY}
+    DESTINATION
+      ${LIB_INSTALL_DIR}
+    COMPONENT
+      libraries
+  )
+
 endif (WITH_STATIC_LIB)