aboutsummaryrefslogtreecommitdiff
path: root/cmake/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/Modules')
-rw-r--r--cmake/Modules/FindGettextLib.cmake80
-rw-r--r--cmake/Modules/FindJthread.cmake18
-rw-r--r--cmake/Modules/FindSqlite3.cmake18
3 files changed, 116 insertions, 0 deletions
diff --git a/cmake/Modules/FindGettextLib.cmake b/cmake/Modules/FindGettextLib.cmake
new file mode 100644
index 000000000..b99fd33b8
--- /dev/null
+++ b/cmake/Modules/FindGettextLib.cmake
@@ -0,0 +1,80 @@
+# Package finder for gettext libs and include files
+
+SET(CUSTOM_GETTEXT_PATH "${PROJECT_SOURCE_DIR}/../../gettext"
+ CACHE FILEPATH "path to custom gettext")
+
+# by default
+SET(GETTEXT_FOUND FALSE)
+
+FIND_PATH(GETTEXT_INCLUDE_DIR
+ NAMES libintl.h
+ PATHS "${CUSTOM_GETTEXT_PATH}/include"
+ DOC "gettext include directory")
+
+FIND_PROGRAM(GETTEXT_MSGFMT
+ NAMES msgfmt
+ PATHS "${CUSTOM_GETTEXT_PATH}/bin"
+ DOC "path to msgfmt")
+
+FIND_PROGRAM(GETTEXT_MSGMERGE
+ NAMES msgmerge
+ PATHS "${CUSTOM_GETTEXT_PATH}/bin"
+ DOC "path to msgmerge")
+
+FIND_PROGRAM(GETTEXT_MSGEN
+ NAMES msgen
+ PATHS "${CUSTOM_GETTEXT_PATH}/bin"
+ DOC "path to msgen")
+
+FIND_PROGRAM(GETTEXT_EXTRACT
+ NAMES xgettext
+ PATHS "${CUSTOM_GETTEXT_PATH}/bin"
+ DOC "path to xgettext")
+
+# modern Linux, as well as Mac, seem to not need require special linking
+# they do not because gettext is part of glibc
+# TODO check the requirements on other BSDs and older Linux
+IF (WIN32)
+ IF(MSVC)
+ SET(GETTEXT_LIB_NAMES
+ libintl.lib intl.lib libintl3.lib intl3.lib)
+ ELSE()
+ SET(GETTEXT_LIB_NAMES
+ libintl.dll.a intl.dll.a libintl3.dll.a intl3.dll.a)
+ ENDIF()
+ FIND_LIBRARY(GETTEXT_LIBRARY
+ NAMES ${GETTEXT_LIB_NAMES}
+ PATHS "${CUSTOM_GETTEXT_PATH}/lib"
+ DOC "gettext *intl*.lib")
+ FIND_FILE(GETTEXT_DLL
+ NAMES libintl.dll intl.dll libintl3.dll intl3.dll
+ PATHS "${CUSTOM_GETTEXT_PATH}/bin" "${CUSTOM_GETTEXT_PATH}/lib"
+ DOC "gettext *intl*.dll")
+ FIND_FILE(GETTEXT_ICONV_DLL
+ NAMES libiconv2.dll
+ PATHS "${CUSTOM_GETTEXT_PATH}/bin" "${CUSTOM_GETTEXT_PATH}/lib"
+ DOC "gettext *iconv*.lib")
+ENDIF(WIN32)
+
+
+IF(GETTEXT_INCLUDE_DIR AND GETTEXT_MSGFMT)
+ IF (WIN32)
+ # in the Win32 case check also for the extra linking requirements
+ IF(GETTEXT_LIBRARY AND GETTEXT_DLL AND GETTEXT_ICONV_DLL)
+ SET(GETTEXT_FOUND TRUE)
+ ENDIF()
+ ELSE(WIN32)
+ SET(GETTEXT_FOUND TRUE)
+ ENDIF(WIN32)
+ENDIF()
+
+IF(GETTEXT_FOUND)
+ SET(GETTEXT_PO_PATH ${CMAKE_SOURCE_DIR}/po)
+ SET(GETTEXT_MO_BUILD_PATH ${CMAKE_BINARY_DIR}/locale/<locale>/LC_MESSAGES)
+ SET(GETTEXT_MO_DEST_PATH locale/<locale>/LC_MESSAGES)
+ FILE(GLOB GETTEXT_AVAILABLE_LOCALES RELATIVE ${GETTEXT_PO_PATH} "${GETTEXT_PO_PATH}/*")
+ MACRO(SET_MO_PATHS _buildvar _destvar _locale)
+ STRING(REPLACE "<locale>" ${_locale} ${_buildvar} ${GETTEXT_MO_BUILD_PATH})
+ STRING(REPLACE "<locale>" ${_locale} ${_destvar} ${GETTEXT_MO_DEST_PATH})
+ ENDMACRO(SET_MO_PATHS)
+ENDIF()
diff --git a/cmake/Modules/FindJthread.cmake b/cmake/Modules/FindJthread.cmake
new file mode 100644
index 000000000..302a3c22f
--- /dev/null
+++ b/cmake/Modules/FindJthread.cmake
@@ -0,0 +1,18 @@
+# Look for jthread, use our own if not found
+
+FIND_PATH(JTHREAD_INCLUDE_DIR jthread.h)
+
+FIND_LIBRARY(JTHREAD_LIBRARY NAMES jthread)
+
+IF(JTHREAD_LIBRARY AND JTHREAD_INCLUDE_DIR)
+ SET( JTHREAD_FOUND TRUE )
+ENDIF(JTHREAD_LIBRARY AND JTHREAD_INCLUDE_DIR)
+
+IF(JTHREAD_FOUND)
+ MESSAGE(STATUS "Found system jthread header file in ${JTHREAD_INCLUDE_DIR}")
+ MESSAGE(STATUS "Found system jthread library ${JTHREAD_LIBRARY}")
+ELSE(JTHREAD_FOUND)
+ SET(JTHREAD_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/jthread)
+ SET(JTHREAD_LIBRARY jthread)
+ MESSAGE(STATUS "Using project jthread library")
+ENDIF(JTHREAD_FOUND)
diff --git a/cmake/Modules/FindSqlite3.cmake b/cmake/Modules/FindSqlite3.cmake
new file mode 100644
index 000000000..ecce6e38e
--- /dev/null
+++ b/cmake/Modules/FindSqlite3.cmake
@@ -0,0 +1,18 @@
+# Look for sqlite3, use our own if not found
+
+FIND_PATH(SQLITE3_INCLUDE_DIR sqlite3.h)
+
+FIND_LIBRARY(SQLITE3_LIBRARY NAMES sqlite3)
+
+IF(SQLITE3_LIBRARY AND SQLITE3_INCLUDE_DIR)
+ SET( SQLITE3_FOUND TRUE )
+ENDIF(SQLITE3_LIBRARY AND SQLITE3_INCLUDE_DIR)
+
+IF(SQLITE3_FOUND)
+ MESSAGE(STATUS "Found system sqlite3 header file in ${SQLITE3_INCLUDE_DIR}")
+ MESSAGE(STATUS "Found system sqlite3 library ${SQLITE3_LIBRARY}")
+ELSE(SQLITE3_FOUND)
+ SET(SQLITE3_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/sqlite)
+ SET(SQLITE3_LIBRARY sqlite3)
+ MESSAGE(STATUS "Using project sqlite3 library")
+ENDIF(SQLITE3_FOUND)