summaryrefslogtreecommitdiffstats
path: root/cmake/modules
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-02-16 20:17:18 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-02-16 20:17:18 +0000
commitcb7eddb91455a69cf66fcd717e91a51ca5e2cfef (patch)
treecf5546e4d7c44370fbe9ca2be937bd254f30ebaa /cmake/modules
downloadkpilot-cb7eddb91455a69cf66fcd717e91a51ca5e2cfef.tar.gz
kpilot-cb7eddb91455a69cf66fcd717e91a51ca5e2cfef.zip
Moved kpilot from kdepim to applications, as the core Trinity libraries should not contain hardware-dependent software
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kpilot@1221127 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'cmake/modules')
-rw-r--r--cmake/modules/FindMal.cmake62
-rw-r--r--cmake/modules/FindPilotlink.cmake55
-rw-r--r--cmake/modules/KPilotCustom.cmake53
3 files changed, 170 insertions, 0 deletions
diff --git a/cmake/modules/FindMal.cmake b/cmake/modules/FindMal.cmake
new file mode 100644
index 0000000..9439d27
--- /dev/null
+++ b/cmake/modules/FindMal.cmake
@@ -0,0 +1,62 @@
+INCLUDE(CheckCXXSourceCompiles)
+
+set(CMAKE_INCLUDE_PATH "${MAL_BASE}/include")
+FIND_PATH(MAL_INCLUDE_DIR libmal.h
+ ${MAL_BASE}/include
+ ${MAL_BASE}/include/libmal
+ /usr/include
+ /usr/include/libmal
+ /usr/local/include
+ /usr/local/include/libmal
+)
+set(CMAKE_LIBRARY_PATH "${MAL_BASE}/lib")
+FIND_LIBRARY(MAL_LIBRARY mal
+ ${MAL_BASE}/lib
+ /usr/lib
+ /usr/lib/libmal
+ /usr/local/lib
+ /usr/local/lib/libmal
+)
+
+IF (NOT MAL_INCLUDE_DIR)
+ MESSAGE(STATUS "Could not find libmal.h")
+ELSE (NOT MAL_INCLUDE_DIR)
+ MESSAGE(STATUS "Found libmal.h in ${MAL_INCLUDE_DIR}")
+ENDIF (NOT MAL_INCLUDE_DIR)
+
+IF (NOT MAL_LIBRARY)
+ MESSAGE(STATUS "Could not find libmal")
+ELSE (NOT MAL_LIBRARY)
+ MESSAGE(STATUS "Found libmal in ${MAL_LIBRARY}")
+ENDIF (NOT MAL_LIBRARY)
+
+IF (MAL_INCLUDE_DIR AND MAL_LIBRARY)
+ SET(MAL_FOUND TRUE)
+ENDIF (MAL_INCLUDE_DIR AND MAL_LIBRARY)
+
+IF (MAL_FOUND)
+ SET(CMAKE_REQUIRED_INCLUDES ${MAL_INCLUDE_DIR} ${PILOTLINK_INCLUDE_DIR})
+ CHECK_CXX_SOURCE_COMPILES("
+#include <libmal.h>
+#define LIBMAL_IS(a,b) ((LIBMAL_VERSION > a) || ((LIBMAL_VERSION == a) && ((LIBMAL_MAJOR > b) || (LIBMAL_MAJOR == b))))
+#if !LIBMAL_IS(0,40)
+#error \"Libmal version is < 0.40\"
+#else
+int main() { return 0; }
+#endif
+"
+ MAL_VERSION_OK)
+ENDIF (MAL_FOUND)
+
+IF (NOT MAL_VERSION_OK)
+ SET(MAL_FOUND FALSE)
+ MESSAGE(STATUS "Found mal, but it's not at least version 0.40.")
+ENDIF (NOT MAL_VERSION_OK)
+
+
+IF (MAL_FOUND)
+ MESSAGE(STATUS "Found mal: ${MAL_LIBRARY}")
+ELSE (MAL_FOUND)
+ MESSAGE(STATUS "Couldn't find acceptable mal version. Won't be able to build malconduit")
+ENDIF (MAL_FOUND)
+
diff --git a/cmake/modules/FindPilotlink.cmake b/cmake/modules/FindPilotlink.cmake
new file mode 100644
index 0000000..649419e
--- /dev/null
+++ b/cmake/modules/FindPilotlink.cmake
@@ -0,0 +1,55 @@
+INCLUDE(CheckCXXSourceCompiles)
+
+set(CMAKE_INCLUDE_PATH "${PILOTLINK_BASE}/include")
+FIND_PATH(PILOTLINK_INCLUDE_DIR pi-dlp.h
+ /usr/include
+ /usr/include/libpisock
+ /usr/local/include
+ )
+set(CMAKE_LIBRARY_PATH "${PILOTLINK_BASE}/lib")
+FIND_LIBRARY(PILOTLINK_LIBRARY pisock
+ /usr/lib
+ /usr/local/lib
+ )
+
+IF (NOT PILOTLINK_INCLUDE_DIR)
+ MESSAGE(STATUS "Could not find pilot-link (pi-dlp.h)")
+ELSE (NOT PILOTLINK_INCLUDE_DIR)
+ MESSAGE(STATUS "Found pilot-link includes in ${PILOTLINK_INCLUDE_DIR}")
+ENDIF (NOT PILOTLINK_INCLUDE_DIR)
+
+IF (NOT PILOTLINK_LIBRARY)
+ MESSAGE(STATUS "Could not find pilot-link (libpisock.so)")
+ELSE (NOT PILOTLINK_LIBRARY)
+ MESSAGE(STATUS "Found pilot-link libraries in ${PILOTLINK_LIBRARY}")
+ENDIF (NOT PILOTLINK_LIBRARY)
+
+IF (PILOTLINK_INCLUDE_DIR AND PILOTLINK_LIBRARY)
+ SET(PILOTLINK_FOUND TRUE)
+ENDIF (PILOTLINK_INCLUDE_DIR AND PILOTLINK_LIBRARY)
+
+IF (PILOTLINK_FOUND)
+ SET(CMAKE_REQUIRED_INCLUDES ${PILOTLINK_INCLUDE_DIR})
+ CHECK_CXX_SOURCE_COMPILES("
+#include <pi-version.h>
+#if !PILOT_LINK_IS(0,12,0)
+#error \"Pilot-link version is < 0.12.0\"
+#else
+int main() { return 0; }
+#endif
+"
+ PILOTLINK_VERSION_OK)
+ENDIF (PILOTLINK_FOUND)
+
+IF (NOT PILOTLINK_VERSION_OK)
+ SET(PILOTLINK_FOUND FALSE)
+ENDIF (NOT PILOTLINK_VERSION_OK)
+
+
+IF (NOT PILOTLINK_FOUND)
+ IF (Pilotlink_FIND_REQUIRED)
+ MESSAGE(STATUS "KPilot requires pilot-link 0.12.0 or later. Pilot-link is available from pilot-link.org and is packaged by most distributions. Remember to install the development package with the compilation headers as well.")
+ MESSAGE(FATAL_ERROR "Could not find pilot-link.")
+ ENDIF (Pilotlink_FIND_REQUIRED)
+ENDIF (NOT PILOTLINK_FOUND)
+
diff --git a/cmake/modules/KPilotCustom.cmake b/cmake/modules/KPilotCustom.cmake
new file mode 100644
index 0000000..08b255d
--- /dev/null
+++ b/cmake/modules/KPilotCustom.cmake
@@ -0,0 +1,53 @@
+MACRO(KDE3_INSTALL_ICONS_CUSTOM _theme)
+ ADD_CUSTOM_TARGET(install_icons )
+ SET_TARGET_PROPERTIES(install_icons PROPERTIES POST_INSTALL_SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/install_icons.cmake )
+ FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/install_icons.cmake "# icon installations rules\n")
+ FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/install_icons.cmake "SET(CMAKE_BACKWARDS_COMPATIBILITY \"2.2\") \n")
+
+ FILE(GLOB _icons *.png)
+ FOREACH(_current_ICON ${_icons} )
+ STRING(REGEX REPLACE "^.*/[a-zA-Z]+([0-9]+)\\-([a-z]+)\\-(.+\\.png)$" "\\1" _size "${_current_ICON}")
+ STRING(REGEX REPLACE "^.*/[a-zA-Z]+([0-9]+)\\-([a-z]+)\\-(.+\\.png)$" "\\2" _group "${_current_ICON}")
+ STRING(REGEX REPLACE "^.*/[a-zA-Z]+([0-9]+)\\-([a-z]+)\\-(.+\\.png)$" "\\3" _name "${_current_ICON}")
+
+ SET(_icon_GROUP "unknown")
+
+ IF(${_group} STREQUAL "mime")
+ SET(_icon_GROUP "mimetypes")
+ ENDIF(${_group} STREQUAL "mime")
+
+ IF(${_group} STREQUAL "filesys")
+ SET(_icon_GROUP "filesystems")
+ ENDIF(${_group} STREQUAL "filesys")
+
+ IF(${_group} STREQUAL "device")
+ SET(_icon_GROUP "devices")
+ ENDIF(${_group} STREQUAL "device")
+
+ IF(${_group} STREQUAL "app")
+ SET(_icon_GROUP "apps")
+ ENDIF(${_group} STREQUAL "app")
+
+ IF(${_group} STREQUAL "action")
+ SET(_icon_GROUP "actions")
+ ENDIF(${_group} STREQUAL "action")
+
+ IF( NOT ${_icon_GROUP} STREQUAL "unknown")
+# message(STATUS "icon: ${_current_ICON} size: ${_size} group: ${_group} name: ${_name}" )
+ SET(_ICON_INSTALL_NAME ${CMAKE_INSTALL_PREFIX}/share/icons/${_theme}/${_size}x${_size}/${_icon_GROUP}/${_name})
+ FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/install_icons.cmake "message(STATUS \"Installing ${_ICON_INSTALL_NAME}\") \n")
+ FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/install_icons.cmake "CONFIGURE_FILE( ${_current_ICON} ${_ICON_INSTALL_NAME} COPYONLY) \n")
+ ELSE( NOT ${_icon_GROUP} STREQUAL "unknown")
+ message(STATUS "icon: ${_current_ICON} doesn't fit naming conventions. ignoring." )
+ ENDIF( NOT ${_icon_GROUP} STREQUAL "unknown")
+
+ ENDFOREACH (_current_ICON)
+ENDMACRO(KDE3_INSTALL_ICONS_CUSTOM)
+
+
+MACRO(KPILOT_RPATH _thing)
+ set_target_properties(${_thing} PROPERTIES
+ INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib;${KDE3_DIR}/lib;${PILOTLINK_LIBRARY}
+ INSTALL_RPATH_USE_LINK_PATH true
+ )
+ENDMACRO(KPILOT_RPATH _thing)