summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2014-01-20 23:39:19 +0100
committerAndreas Schneider <asn@cryptomilk.org>2014-01-20 23:39:19 +0100
commit3770c5dc8f0718d849eb1d73c29c0b33db253c49 (patch)
treedaa16310c552ef96e040aea17130e6fb23d29311
parent11df27bbf33664611840abca158d4f75e79eaa0b (diff)
downloadcmocka-3770c5dc8f0718d849eb1d73c29c0b33db253c49.tar.gz
cmocka-3770c5dc8f0718d849eb1d73c29c0b33db253c49.tar.bz2
cmocka-3770c5dc8f0718d849eb1d73c29c0b33db253c49.zip
cmake: Add cmake config mode support.
-rw-r--r--CMakeLists.txt13
-rw-r--r--cmake/Modules/DefineInstallationPaths.cmake14
-rw-r--r--cmocka-build-tree-settings.cmake.in1
-rw-r--r--cmocka-config-version.cmake.in11
-rw-r--r--cmocka-config.cmake.in11
5 files changed, 46 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9952c4a..7752d78 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -65,3 +65,16 @@ install(
COMPONENT
pkgconfig
)
+
+# cmake config files
+configure_file(cmocka-config.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/cmocka-config.cmake @ONLY)
+configure_file(cmocka-config-version.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/cmocka-config-version.cmake @ONLY)
+install(
+ FILES
+ ${CMAKE_CURRENT_BINARY_DIR}/cmocka-config.cmake
+ ${CMAKE_CURRENT_BINARY_DIR}/cmocka-config-version.cmake
+ DESTINATION
+ ${CMAKE_INSTALL_DIR}
+ COMPONENT
+ devel
+)
diff --git a/cmake/Modules/DefineInstallationPaths.cmake b/cmake/Modules/DefineInstallationPaths.cmake
index 14507ed..88e08ca 100644
--- a/cmake/Modules/DefineInstallationPaths.cmake
+++ b/cmake/Modules/DefineInstallationPaths.cmake
@@ -1,4 +1,4 @@
-if (UNIX)
+if (UNIX OR OS2)
IF (NOT APPLICATION_NAME)
MESSAGE(STATUS "${PROJECT_NAME} is used as APPLICATION_NAME")
SET(APPLICATION_NAME ${PROJECT_NAME})
@@ -47,6 +47,10 @@ if (UNIX)
CACHE PATH "The subdirectory to the header prefix (default prefix/include)"
)
+ set(CMAKE_INSTALL_DIR
+ "${LIB_INSTALL_DIR}/cmake"
+ CACHE PATH "The subdirectory to install cmake config files")
+
SET(DATA_INSTALL_DIR
"${DATA_INSTALL_PREFIX}"
CACHE PATH "The parent directory where applications can install their data (default prefix/share/${APPLICATION_NAME})"
@@ -91,13 +95,15 @@ if (UNIX)
CACHE PATH "The ${APPLICATION_NAME} info install dir (default prefix/info)"
)
else()
+ # Same same
set(BIN_INSTALL_DIR "bin" CACHE PATH "-")
- set(SBIN_INSTALL_DIR "." CACHE PATH "-")
+ set(SBIN_INSTALL_DIR "sbin" CACHE PATH "-")
set(LIB_INSTALL_DIR "lib${LIB_SUFFIX}" CACHE PATH "-")
set(INCLUDE_INSTALL_DIR "include" CACHE PATH "-")
+ set(CMAKE_INSTALL_DIR "CMake" CACHE PATH "-")
set(PLUGIN_INSTALL_DIR "plugins" CACHE PATH "-")
set(HTML_INSTALL_DIR "doc/HTML" CACHE PATH "-")
- set(ICON_INSTALL_DIR "." CACHE PATH "-")
- set(SOUND_INSTALL_DIR "." CACHE PATH "-")
+ set(ICON_INSTALL_DIR "icons" CACHE PATH "-")
+ set(SOUND_INSTALL_DIR "soudns" CACHE PATH "-")
set(LOCALE_INSTALL_DIR "lang" CACHE PATH "-")
endif ()
diff --git a/cmocka-build-tree-settings.cmake.in b/cmocka-build-tree-settings.cmake.in
new file mode 100644
index 0000000..eb1f29e
--- /dev/null
+++ b/cmocka-build-tree-settings.cmake.in
@@ -0,0 +1 @@
+set(CMOCKA_INLUDE_DIR @PROJECT_SOURCE_DIR@/include)
diff --git a/cmocka-config-version.cmake.in b/cmocka-config-version.cmake.in
new file mode 100644
index 0000000..98f292c
--- /dev/null
+++ b/cmocka-config-version.cmake.in
@@ -0,0 +1,11 @@
+set(PACKAGE_VERSION @APPLICATION_VERSION@)
+
+# Check whether the requested PACKAGE_FIND_VERSION is compatible
+if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")
+ set(PACKAGE_VERSION_COMPATIBLE FALSE)
+else()
+ set(PACKAGE_VERSION_COMPATIBLE TRUE)
+ if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}")
+ set(PACKAGE_VERSION_EXACT TRUE)
+ endif()
+endif()
diff --git a/cmocka-config.cmake.in b/cmocka-config.cmake.in
new file mode 100644
index 0000000..10aecb4
--- /dev/null
+++ b/cmocka-config.cmake.in
@@ -0,0 +1,11 @@
+get_filename_component(CMOCKA_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
+
+if (EXISTS "${CMOCKA_CMAKE_DIR}/CMakeCache.txt")
+ # In build tree
+ include(${CMOCKA_CMAKE_DIR}/cmocka-build-tree-settings.cmake)
+else()
+ set(CMOCKA_INCLUDE_DIR @INCLUDE_INSTALL_DIR@)
+endif()
+
+set(CMOCKA_LIRBARY @LIB_INSTALL_DIR@/cmocka.so)
+set(CMOCKA_LIRBARIES @LIB_INSTALL_DIR@/cmocka.so)