diff --git a/CMakeLists.txt b/CMakeLists.txt index 6b367d6..22ea9b0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,4 +47,20 @@ INSTALL(TARGETS serial INSTALL(FILES include/serial.h DESTINATION include) -# INSTALL(FILES ../Findserial.cmake DESTINATION ${CMAKE_ROOT}/Modules/) \ No newline at end of file +INSTALL(FILES Findserial.cmake DESTINATION ${CMAKE_ROOT}/Modules/) + +ADD_CUSTOM_TARGET (uninstall @echo uninstall package) + +IF (UNIX) + ADD_CUSTOM_COMMAND( + COMMENT "uninstall package" + COMMAND xargs ARGS rm < install_manifest.txt + + TARGET uninstall + ) +ELSE(UNIX) + ADD_CUSTOM_COMMAND( + COMMENT "uninstall only implemented in unix" + TARGET uninstall + ) +ENDIF(UNIX) \ No newline at end of file diff --git a/Findserial.cmake b/Findserial.cmake new file mode 100644 index 0000000..b102e26 --- /dev/null +++ b/Findserial.cmake @@ -0,0 +1,13 @@ +find_path(serial_INCLUDE_DIRS serial.h /usr/include "$ENV{NAMER_ROOT}") + +find_library(serial_LIBRARIES serial /usr/lib "$ENV{NAMER_ROOT}") + +set(serial_FOUND TRUE) + +if (NOT serial_INCLUDE_DIRS) + set(serial_FOUND FALSE) +endif (NOT serial_INCLUDE_DIRS) + +if (NOT serial_LIBRARIES) + set(serial_FOUND FALSE) +endif (NOT serial_LIBRARIES) \ No newline at end of file diff --git a/Makefile b/Makefile index 76eb6a8..4f5cb58 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,12 @@ -all: +all: serial + +install: + cd build && make install + +uninstall: + cd build && make uninstall + +serial: @mkdir -p build -mkdir -p bin cd build && cmake $(CMAKE_FLAGS) .. @@ -10,4 +18,4 @@ endif clean: -cd build && make clean - rm -rf build bin lib \ No newline at end of file + rm -rf build bin lib