ref: 0202d13dec910d55acc5b92c290b9aaa72d8b691
parent: 5e4248f2e98ac13f30c2b84a7e444691276b85ea
author: gkostka <[email protected]>
date: Thu Mar 31 16:43:31 EDT 2016
CMake: add library & headers to make install target
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -37,6 +37,7 @@
else()
#Generic example target
set(BLOCKDEV_TYPE linux)
+ set (INSTALL_LIB 1)
add_definitions(-DCONFIG_HAVE_OWN_OFLAGS=0)
add_definitions(-DCONFIG_HAVE_OWN_ERRNO=0)
add_definitions(-DCONFIG_HAVE_OWN_ASSERT=0)
--- a/fs_test/CMakeLists.txt
+++ b/fs_test/CMakeLists.txt
@@ -29,3 +29,4 @@
install (TARGETS lwext4-generic DESTINATION /usr/bin)
install (TARGETS lwext4-mkfs DESTINATION /usr/bin)
install (TARGETS lwext4-mbr DESTINATION /usr/bin)
+
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -2,9 +2,15 @@
#LIBRARY
include_directories(.)
aux_source_directory(. LWEXT4_SRC)
-add_library(lwext4 ${LWEXT4_SRC})
+add_library(lwext4 STATIC ${LWEXT4_SRC})
+
if (DEFINED SIZE)
add_custom_target(lib_size ALL DEPENDS lwext4 COMMAND ${SIZE} liblwext4.a)
else()
endif()
+
+if (DEFINED INSTALL_LIB)
+INSTALL(TARGETS lwext4 DESTINATION /usr/local/lib)
+INSTALL(DIRECTORY ${PROJECT_BINARY_DIR}/include/. DESTINATION /usr/local/include/lwext4)
+endif()
\ No newline at end of file