diff options
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/CheckConstantExists.cmake | 38 | ||||
-rw-r--r-- | Modules/FindPLIST.cmake | 31 | ||||
-rw-r--r-- | Modules/FindUSB.cmake | 40 | ||||
-rw-r--r-- | Modules/LibFindMacros.cmake | 99 | ||||
-rw-r--r-- | Modules/VersionTag.cmake | 13 | ||||
-rw-r--r-- | Modules/cmake_uninstall.cmake.in | 21 | ||||
-rwxr-xr-x | Modules/describe.sh | 17 |
7 files changed, 0 insertions, 259 deletions
diff --git a/Modules/CheckConstantExists.cmake b/Modules/CheckConstantExists.cmake deleted file mode 100644 index 3d6d97e..0000000 --- a/Modules/CheckConstantExists.cmake +++ /dev/null | |||
@@ -1,38 +0,0 @@ | |||
1 | # - Check if the given constant exists (as an enum, define, or whatever) | ||
2 | # CHECK_CONSTANT_EXISTS (CONSTANT HEADER VARIABLE) | ||
3 | # | ||
4 | # CONSTANT - the name of the constant you are interested in | ||
5 | # HEADER - the header(s) where the prototype should be declared | ||
6 | # VARIABLE - variable to store the result | ||
7 | # | ||
8 | # The following variables may be set before calling this macro to | ||
9 | # modify the way the check is run: | ||
10 | # | ||
11 | # CMAKE_REQUIRED_FLAGS = string of compile command line flags | ||
12 | # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) | ||
13 | # CMAKE_REQUIRED_INCLUDES = list of include directories | ||
14 | # | ||
15 | # Example: CHECK_CONSTANT_EXISTS(O_NOFOLLOW fcntl.h HAVE_O_NOFOLLOW) | ||
16 | |||
17 | |||
18 | INCLUDE(CheckCSourceCompiles) | ||
19 | |||
20 | MACRO (CHECK_CONSTANT_EXISTS _CONSTANT _HEADER _RESULT) | ||
21 | SET(_INCLUDE_FILES) | ||
22 | FOREACH (it ${_HEADER}) | ||
23 | SET(_INCLUDE_FILES "${_INCLUDE_FILES}#include <${it}>\n") | ||
24 | ENDFOREACH (it) | ||
25 | |||
26 | SET(_CHECK_CONSTANT_SOURCE_CODE " | ||
27 | ${_INCLUDE_FILES} | ||
28 | void cmakeRequireConstant(int dummy,...){(void)dummy;} | ||
29 | int main() | ||
30 | { | ||
31 | cmakeRequireConstant(0,${_CONSTANT}); | ||
32 | return 0; | ||
33 | } | ||
34 | ") | ||
35 | CHECK_C_SOURCE_COMPILES("${_CHECK_CONSTANT_SOURCE_CODE}" ${_RESULT}) | ||
36 | |||
37 | ENDMACRO (CHECK_CONSTANT_EXISTS) | ||
38 | |||
diff --git a/Modules/FindPLIST.cmake b/Modules/FindPLIST.cmake deleted file mode 100644 index d51aa74..0000000 --- a/Modules/FindPLIST.cmake +++ /dev/null | |||
@@ -1,31 +0,0 @@ | |||
1 | # - Try to find libplist | ||
2 | # Once done, this will define | ||
3 | # | ||
4 | # PLIST_FOUND - system has libplist | ||
5 | # PLIST_INCLUDE_DIRS - the libplist include directories | ||
6 | # PLIST_LIBRARIES - link these to use libplist | ||
7 | |||
8 | include(LibFindMacros) | ||
9 | |||
10 | # Dependencies | ||
11 | |||
12 | # Use pkg-config to get hints about paths | ||
13 | libfind_pkg_check_modules(PLIST_PKGCONF libplist >= 0.15) | ||
14 | |||
15 | # Include dir | ||
16 | find_path(PLIST_INCLUDE_DIR | ||
17 | NAMES plist/plist.h | ||
18 | PATHS ${PLIST_PKGCONF_INCLUDE_DIRS} | ||
19 | ) | ||
20 | |||
21 | # Finally the library itself | ||
22 | find_library(PLIST_LIBRARY | ||
23 | NAMES plist | ||
24 | PATHS ${PLIST_PKGCONF_LIBRARY_DIRS} | ||
25 | ) | ||
26 | |||
27 | # Set the include dir variables and the libraries and let libfind_process do the rest. | ||
28 | # NOTE: Singular variables for this library, plural for libraries that this lib depends on. | ||
29 | set(PLIST_PROCESS_INCLUDES PLIST_INCLUDE_DIR) | ||
30 | set(PLIST_PROCESS_LIBS PLIST_LIBRARY) | ||
31 | libfind_process(PLIST) | ||
diff --git a/Modules/FindUSB.cmake b/Modules/FindUSB.cmake deleted file mode 100644 index 486864f..0000000 --- a/Modules/FindUSB.cmake +++ /dev/null | |||
@@ -1,40 +0,0 @@ | |||
1 | # - Try to find libusb-1.0 | ||
2 | # Once done, this will define | ||
3 | # | ||
4 | # USB_FOUND - system has libusb-1.0 | ||
5 | # USB_INCLUDE_DIRS - the libusb-1.0 include directories | ||
6 | # USB_LIBRARIES - link these to use libusb-1.0 | ||
7 | |||
8 | include(LibFindMacros) | ||
9 | |||
10 | # Dependencies | ||
11 | |||
12 | # pkg-config + libusb fails on FreeBSD, though libusb is in base | ||
13 | if(NOT(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")) | ||
14 | # Use pkg-config to get hints about paths | ||
15 | libfind_pkg_check_modules(USB_PKGCONF libusb-1.0>=1.0.3) | ||
16 | # We want to look for libusb-1.0 | ||
17 | set(USB_LIBRARY_NAME usb-1.0) | ||
18 | else() | ||
19 | set(USB_PKGCONF_INCLUDE_DIRS /usr/include) | ||
20 | set(USB_PKGCONF_LIBRARY_DIRS /usr/lib) | ||
21 | set(USB_LIBRARY_NAME usb) | ||
22 | endif() | ||
23 | |||
24 | # Include dir | ||
25 | find_path(USB_INCLUDE_DIR | ||
26 | NAMES libusb.h | ||
27 | PATHS ${USB_PKGCONF_INCLUDE_DIRS} | ||
28 | ) | ||
29 | |||
30 | # Finally the library itself | ||
31 | find_library(USB_LIBRARY | ||
32 | NAMES ${USB_LIBRARY_NAME} | ||
33 | PATHS ${USB_PKGCONF_LIBRARY_DIRS} | ||
34 | ) | ||
35 | |||
36 | # Set the include dir variables and the libraries and let libfind_process do the rest. | ||
37 | # NOTE: Singular variables for this library, plural for libraries this this lib depends on. | ||
38 | set(USB_PROCESS_INCLUDES USB_INCLUDE_DIR) | ||
39 | set(USB_PROCESS_LIBS USB_LIBRARY) | ||
40 | libfind_process(USB) | ||
diff --git a/Modules/LibFindMacros.cmake b/Modules/LibFindMacros.cmake deleted file mode 100644 index 795d6b7..0000000 --- a/Modules/LibFindMacros.cmake +++ /dev/null | |||
@@ -1,99 +0,0 @@ | |||
1 | # Works the same as find_package, but forwards the "REQUIRED" and "QUIET" arguments | ||
2 | # used for the current package. For this to work, the first parameter must be the | ||
3 | # prefix of the current package, then the prefix of the new package etc, which are | ||
4 | # passed to find_package. | ||
5 | macro (libfind_package PREFIX) | ||
6 | set (LIBFIND_PACKAGE_ARGS ${ARGN}) | ||
7 | if (${PREFIX}_FIND_QUIETLY) | ||
8 | set (LIBFIND_PACKAGE_ARGS ${LIBFIND_PACKAGE_ARGS} QUIET) | ||
9 | endif (${PREFIX}_FIND_QUIETLY) | ||
10 | if (${PREFIX}_FIND_REQUIRED) | ||
11 | set (LIBFIND_PACKAGE_ARGS ${LIBFIND_PACKAGE_ARGS} REQUIRED) | ||
12 | endif (${PREFIX}_FIND_REQUIRED) | ||
13 | find_package(${LIBFIND_PACKAGE_ARGS}) | ||
14 | endmacro (libfind_package) | ||
15 | |||
16 | # Damn CMake developers made the UsePkgConfig system deprecated in the same release (2.6) | ||
17 | # where they added pkg_check_modules. Consequently I need to support both in my scripts | ||
18 | # to avoid those deprecated warnings. Here's a helper that does just that. | ||
19 | # Works identically to pkg_check_modules, except that no checks are needed prior to use. | ||
20 | macro (libfind_pkg_check_modules PREFIX PKGNAME) | ||
21 | if (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4) | ||
22 | include(UsePkgConfig) | ||
23 | pkgconfig(${PKGNAME} ${PREFIX}_INCLUDE_DIRS ${PREFIX}_LIBRARY_DIRS ${PREFIX}_LDFLAGS ${PREFIX}_CFLAGS) | ||
24 | else (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4) | ||
25 | find_package(PkgConfig) | ||
26 | if (PKG_CONFIG_FOUND) | ||
27 | pkg_check_modules(${PREFIX} ${PKGNAME}) | ||
28 | endif (PKG_CONFIG_FOUND) | ||
29 | endif (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4) | ||
30 | endmacro (libfind_pkg_check_modules) | ||
31 | |||
32 | # Do the final processing once the paths have been detected. | ||
33 | # If include dirs are needed, ${PREFIX}_PROCESS_INCLUDES should be set to contain | ||
34 | # all the variables, each of which contain one include directory. | ||
35 | # Ditto for ${PREFIX}_PROCESS_LIBS and library files. | ||
36 | # Will set ${PREFIX}_FOUND, ${PREFIX}_INCLUDE_DIRS and ${PREFIX}_LIBRARIES. | ||
37 | # Also handles errors in case library detection was required, etc. | ||
38 | macro (libfind_process PREFIX) | ||
39 | # Skip processing if already processed during this run | ||
40 | if (NOT ${PREFIX}_FOUND) | ||
41 | # Start with the assumption that the library was found | ||
42 | set (${PREFIX}_FOUND TRUE) | ||
43 | |||
44 | # Process all includes and set _FOUND to false if any are missing | ||
45 | foreach (i ${${PREFIX}_PROCESS_INCLUDES}) | ||
46 | if (${i}) | ||
47 | set (${PREFIX}_INCLUDE_DIRS ${${PREFIX}_INCLUDE_DIRS} ${${i}}) | ||
48 | mark_as_advanced(${i}) | ||
49 | else (${i}) | ||
50 | set (${PREFIX}_FOUND FALSE) | ||
51 | endif (${i}) | ||
52 | endforeach (i) | ||
53 | |||
54 | # Process all libraries and set _FOUND to false if any are missing | ||
55 | foreach (i ${${PREFIX}_PROCESS_LIBS}) | ||
56 | if (${i}) | ||
57 | set (${PREFIX}_LIBRARIES ${${PREFIX}_LIBRARIES} ${${i}}) | ||
58 | mark_as_advanced(${i}) | ||
59 | else (${i}) | ||
60 | set (${PREFIX}_FOUND FALSE) | ||
61 | endif (${i}) | ||
62 | endforeach (i) | ||
63 | |||
64 | # Print message and/or exit on fatal error | ||
65 | if (${PREFIX}_FOUND) | ||
66 | if (NOT ${PREFIX}_FIND_QUIETLY) | ||
67 | message (STATUS "Found ${PREFIX} ${${PREFIX}_VERSION}") | ||
68 | endif (NOT ${PREFIX}_FIND_QUIETLY) | ||
69 | else (${PREFIX}_FOUND) | ||
70 | if (${PREFIX}_FIND_REQUIRED) | ||
71 | foreach (i ${${PREFIX}_PROCESS_INCLUDES} ${${PREFIX}_PROCESS_LIBS}) | ||
72 | message("${i}=${${i}}") | ||
73 | endforeach (i) | ||
74 | message (FATAL_ERROR "Required library ${PREFIX} NOT FOUND.\nInstall the library (dev version) and try again. If the library is already installed, use ccmake to set the missing variables manually.") | ||
75 | endif (${PREFIX}_FIND_REQUIRED) | ||
76 | endif (${PREFIX}_FOUND) | ||
77 | endif (NOT ${PREFIX}_FOUND) | ||
78 | endmacro (libfind_process) | ||
79 | |||
80 | macro(libfind_library PREFIX basename) | ||
81 | set(TMP "") | ||
82 | if(MSVC80) | ||
83 | set(TMP -vc80) | ||
84 | endif(MSVC80) | ||
85 | if(MSVC90) | ||
86 | set(TMP -vc90) | ||
87 | endif(MSVC90) | ||
88 | set(${PREFIX}_LIBNAMES ${basename}${TMP}) | ||
89 | if(${ARGC} GREATER 2) | ||
90 | set(${PREFIX}_LIBNAMES ${basename}${TMP}-${ARGV2}) | ||
91 | string(REGEX REPLACE "\\." "_" TMP ${${PREFIX}_LIBNAMES}) | ||
92 | set(${PREFIX}_LIBNAMES ${${PREFIX}_LIBNAMES} ${TMP}) | ||
93 | endif(${ARGC} GREATER 2) | ||
94 | find_library(${PREFIX}_LIBRARY | ||
95 | NAMES ${${PREFIX}_LIBNAMES} | ||
96 | PATHS ${${PREFIX}_PKGCONF_LIBRARY_DIRS} | ||
97 | ) | ||
98 | endmacro(libfind_library) | ||
99 | |||
diff --git a/Modules/VersionTag.cmake b/Modules/VersionTag.cmake deleted file mode 100644 index 682ab3e..0000000 --- a/Modules/VersionTag.cmake +++ /dev/null | |||
@@ -1,13 +0,0 @@ | |||
1 | execute_process( | ||
2 | COMMAND "sh" "${CMAKE_SOURCE_DIR}/Modules/describe.sh" | ||
3 | WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" | ||
4 | OUTPUT_VARIABLE DESCRIBE | ||
5 | OUTPUT_STRIP_TRAILING_WHITESPACE | ||
6 | ) | ||
7 | |||
8 | if(DESCRIBE STREQUAL "") | ||
9 | set (VERSION_TAG "UNKNOWN") | ||
10 | else() | ||
11 | string(REGEX REPLACE "^v" "" VERSION_TAG "${DESCRIBE}") | ||
12 | endif() | ||
13 | |||
diff --git a/Modules/cmake_uninstall.cmake.in b/Modules/cmake_uninstall.cmake.in deleted file mode 100644 index 4bfb0bf..0000000 --- a/Modules/cmake_uninstall.cmake.in +++ /dev/null | |||
@@ -1,21 +0,0 @@ | |||
1 | IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") | ||
2 | MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"") | ||
3 | ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") | ||
4 | |||
5 | FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) | ||
6 | STRING(REGEX REPLACE "\n" ";" files "${files}") | ||
7 | FOREACH(file ${files}) | ||
8 | MESSAGE(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"") | ||
9 | IF(EXISTS "$ENV{DESTDIR}${file}") | ||
10 | EXEC_PROGRAM( | ||
11 | "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" | ||
12 | OUTPUT_VARIABLE rm_out | ||
13 | RETURN_VALUE rm_retval | ||
14 | ) | ||
15 | IF(NOT "${rm_retval}" STREQUAL 0) | ||
16 | MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") | ||
17 | ENDIF(NOT "${rm_retval}" STREQUAL 0) | ||
18 | ELSE(EXISTS "$ENV{DESTDIR}${file}") | ||
19 | MESSAGE(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.") | ||
20 | ENDIF(EXISTS "$ENV{DESTDIR}${file}") | ||
21 | ENDFOREACH(file) | ||
diff --git a/Modules/describe.sh b/Modules/describe.sh deleted file mode 100755 index 6425ed5..0000000 --- a/Modules/describe.sh +++ /dev/null | |||
@@ -1,17 +0,0 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | # Check for git and a git repo. | ||
4 | if head=`git rev-parse --verify HEAD 2>/dev/null`; then | ||
5 | /bin/echo -n `git describe` | ||
6 | |||
7 | # Are there uncommitted changes? | ||
8 | git update-index --refresh --unmerged > /dev/null | ||
9 | git diff-index --quiet HEAD || /bin/echo -n -dirty | ||
10 | else | ||
11 | # Check for version tag | ||
12 | if [ -e version.tag ]; then | ||
13 | /bin/echo -n `cat version.tag` | ||
14 | fi | ||
15 | fi | ||
16 | |||
17 | echo | ||