aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt15
-rw-r--r--libmpio/CMakeLists.txt8
-rw-r--r--libmpio/src/CMakeLists.txt2
-rw-r--r--src/CMakeLists.txt2
4 files changed, 25 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7114aa3..3077400 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -3,6 +3,21 @@ cmake_minimum_required (VERSION 2.4)
set (PACKAGE mpiosh)
project (${PACKAGE} C)
+find_library (LIBNCURSES NAMES ncurses)
+find_library (LIBREADLINE NAMES readline)
+
+if (LIBNCURSES)
+ message (STATUS "found ncurses at ${LIBNCURSES}")
+else (LIBNCURSES)
+ message (FATAL_ERROR "ncurses is required")
+endif (LIBNCURSES)
+
+if (LIBREADLINE)
+ message (STATUS "found readline at ${LIBREADLINE}")
+else (LIBREADLINE)
+ message (FATAL_ERROR "readline is required")
+endif (LIBREADLINE)
+
add_subdirectory (libmpio)
add_subdirectory (src)
add_subdirectory (tools)
diff --git a/libmpio/CMakeLists.txt b/libmpio/CMakeLists.txt
index fb590ef..4ceb7fd 100644
--- a/libmpio/CMakeLists.txt
+++ b/libmpio/CMakeLists.txt
@@ -3,4 +3,12 @@ cmake_minimum_required (VERSION 2.4)
set (PACKAGE libmpio)
project (${PACKAGE} C)
+find_library (LIBUSB NAMES usb)
+
+if (LIBUSB)
+ message (STATUS "found libusb at ${LIBUSB}")
+else (LIBUSB)
+ message (FATAL_ERROR "libusb is required")
+endif (LIBUSB)
+
add_subdirectory (src)
diff --git a/libmpio/src/CMakeLists.txt b/libmpio/src/CMakeLists.txt
index 0422cb7..e16f34e 100644
--- a/libmpio/src/CMakeLists.txt
+++ b/libmpio/src/CMakeLists.txt
@@ -5,5 +5,5 @@ include_directories (${CMAKE_CURRENT_SOURCE_DIR}/../)
add_library (mpio STATIC mpio.c io.c debug.c smartmedia.c mmc.c directory.c
fat.c ecc.c cis.c)
-target_link_libraries (mpio -lusb)
+target_link_libraries (mpio ${LIBUSB})
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 7132b28..d7ae94e 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -7,4 +7,4 @@ include_directories (${CMAKE_CURRENT_SOURCE_DIR}/..)
add_executable (mpiosh mpiosh.c callback.c readline.c command.c global.c
cfgio.c cfg.c)
-target_link_libraries (mpiosh mpio -lreadline -lncurses)
+target_link_libraries (mpiosh mpio ${LIBNCURSES} ${LIBREADLINE})