From 1b0c2c8eedb0c8003d3397c2d80f1db170b313cb Mon Sep 17 00:00:00 2001
From: hasherezade <hasherezade@op.pl>
Date: Sat, 28 Feb 2015 16:06:01 +0100
Subject: [PATCH] resolved #97 : added files to build with CMake

---
 CMakeLists.txt           | 23 +++++++++++++++++++++++
 libudis86/CMakeLists.txt | 34 ++++++++++++++++++++++++++++++++++
 udcli/CMakeLists.txt     | 12 ++++++++++++
 3 files changed, 69 insertions(+)
 create mode 100644 CMakeLists.txt
 create mode 100644 libudis86/CMakeLists.txt
 create mode 100644 udcli/CMakeLists.txt

diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..217f0b9
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,23 @@
+cmake_minimum_required (VERSION 2.8)
+project (udis86)
+
+# modules:
+set (M_LIBUDIS "libudis86")
+set (M_UDCLI "udcli")
+
+# modules paths:
+set (LIBUDIS_DIR "${CMAKE_SOURCE_DIR}/${M_LIBUDIS}" CACHE PATH "libudis86 main path")
+set (UDCLI_DIR "${CMAKE_SOURCE_DIR}/${M_UDCLI}" CACHE PATH "udcli main path")
+
+# Add sub-directories
+#
+# libs
+add_subdirectory (libudis86)
+get_property (libudis86_location TARGET libudis86 PROPERTY LOCATION)
+set (LIBUDIS_LIB ${libudis86_location} CACHE FILE "libudis86 library path")
+
+# executables
+add_subdirectory(udcli)
+
+# dependencies
+add_dependencies(udcli libudis86)
diff --git a/libudis86/CMakeLists.txt b/libudis86/CMakeLists.txt
new file mode 100644
index 0000000..0a47f77
--- /dev/null
+++ b/libudis86/CMakeLists.txt
@@ -0,0 +1,34 @@
+cmake_minimum_required (VERSION 2.8)
+
+project (udis86)
+
+set (ITAB_H "${CMAKE_CURRENT_LIST_DIR}/itab.h")
+set (ITAB_C "${CMAKE_CURRENT_LIST_DIR}/itab.c")
+
+if(NOT EXISTS ${ITAB_H} OR NOT EXISTS ${ITAB_C} )
+  message(FATAL_ERROR "You must generate files: ${ITAB_H}, ${ITAB_C} before you start.")
+endif()
+
+include_directories(../)
+
+set (udis86_srcs
+    decode.c
+    itab.c
+    syn.c
+    syn-att.c
+    syn-intel.c
+    udis86.c
+)
+
+set (udis86_hdrs
+    ../udis86.h
+    decode.h
+    itab.h
+    extern.h
+    syn.h
+    types.h
+    udint.h
+)
+
+add_library (libudis86 SHARED ${udis86_srcs} ${udis86_hdrs})
+add_library (libudis86a STATIC ${udis86_srcs} ${udis86_hdrs})
diff --git a/udcli/CMakeLists.txt b/udcli/CMakeLists.txt
new file mode 100644
index 0000000..98edfd6
--- /dev/null
+++ b/udcli/CMakeLists.txt
@@ -0,0 +1,12 @@
+cmake_minimum_required (VERSION 2.8)
+
+project (udcli)
+
+include_directories(../)
+
+set (udcli_srcs
+    udcli.c
+)
+
+add_executable (udcli ${udcli_srcs} )
+target_link_libraries (udcli ${LIBUDIS_LIB})
