build: various improvements

- add option to install only host tools
- add option to specify lib and runtime dir

Type: improvement

Change-Id: I6356b52df459120fc9b0127948bae7679fb10e52
Signed-off-by: Damjan Marion <damarion@cisco.com>
diff --git a/extras/libmemif/src/CMakeLists.txt b/extras/libmemif/src/CMakeLists.txt
index 09a2e4e..aced550 100644
--- a/extras/libmemif/src/CMakeLists.txt
+++ b/extras/libmemif/src/CMakeLists.txt
@@ -32,12 +32,15 @@
 
 include_directories(${HEADERS_DIR})
 
-add_vpp_library(${LIBMEMIF}
-  SOURCES ${MEMIF_SOURCES}
+add_library(memif SHARED ${MEMIF_SOURCES})
+target_link_libraries(memif ${CMAKE_THREAD_LIBS_INIT})
+foreach(file ${MEMIF_HEADERS})
+  get_filename_component(dir ${file} DIRECTORY)
+     install(
+	FILES ${file}
+	DESTINATION include/${lib}/${dir}
+	COMPONENT libmemif-dev
+      )
+endforeach()
 
-  INSTALL_HEADERS ${MEMIF_HEADERS}
-
-  LINK_LIBRARIES ${CMAKE_THREAD_LIBS_INIT}
-
-  COMPONENT libmemif
-)
+install(TARGETS memif DESTINATION lib COMPONENT libmemif)