1
1

cmake: Add cmake config files for new find_package() mode.

Этот коммит содержится в:
Andreas Schneider 2013-02-12 13:31:42 +01:00
родитель afe4c92bbf
Коммит 5d6cab4b14
5 изменённых файлов: 44 добавлений и 0 удалений

Просмотреть файл

@ -89,6 +89,22 @@ install(
pkgconfig pkgconfig
) )
# cmake config files
configure_file(libssh-config.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/libssh-config.cmake @ONLY)
configure_file(libssh-config-version.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/libssh-config-version.cmake @ONLY)
install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/libssh-config.cmake
${CMAKE_CURRENT_BINARY_DIR}/libssh-config-version.cmake
DESTINATION
${CMAKE_INSTALL_DIR}
COMPONENT
devel
)
# in tree build settings
configure_file(libssh-build-tree-settings.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/libssh-build-tree-settings.cmake @ONLY)
add_subdirectory(examples) add_subdirectory(examples)
if (WITH_TESTING) if (WITH_TESTING)

Просмотреть файл

@ -4,6 +4,7 @@ if (WIN32)
set(SBIN_INSTALL_DIR "." CACHE PATH "-") set(SBIN_INSTALL_DIR "." CACHE PATH "-")
set(LIB_INSTALL_DIR "lib" CACHE PATH "-") set(LIB_INSTALL_DIR "lib" CACHE PATH "-")
set(INCLUDE_INSTALL_DIR "include" CACHE PATH "-") set(INCLUDE_INSTALL_DIR "include" CACHE PATH "-")
set(CMAKE_INSTALL_DIR "CMake" CACHE PATH "-")
set(PLUGIN_INSTALL_DIR "plugins" CACHE PATH "-") set(PLUGIN_INSTALL_DIR "plugins" CACHE PATH "-")
set(HTML_INSTALL_DIR "doc/HTML" CACHE PATH "-") set(HTML_INSTALL_DIR "doc/HTML" CACHE PATH "-")
set(ICON_INSTALL_DIR "." CACHE PATH "-") set(ICON_INSTALL_DIR "." CACHE PATH "-")
@ -58,6 +59,10 @@ elseif (UNIX OR OS2)
CACHE PATH "The subdirectory to the header prefix (default prefix/include)" 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 SET(DATA_INSTALL_DIR
"${DATA_INSTALL_PREFIX}" "${DATA_INSTALL_PREFIX}"
CACHE PATH "The parent directory where applications can install their data (default prefix/share/${APPLICATION_NAME})" CACHE PATH "The parent directory where applications can install their data (default prefix/share/${APPLICATION_NAME})"

1
libssh-build-tree-settings.cmake.in Обычный файл
Просмотреть файл

@ -0,0 +1 @@
set(LIBSSH_INLUDE_DIRS @PROJECT_SOURCE_DIR@/include)

11
libssh-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()

11
libssh-config.cmake.in Обычный файл
Просмотреть файл

@ -0,0 +1,11 @@
get_filename_component(LIBSSH_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
if (EXISTS "${LIBSSH_CMAKE_DIR}/CMakeCache.txt")
# In build tree
include(${LIBSSH_CMAKE_DIR}/libssh-build-tree-settings.cmake)
else()
set(LIBSSH_INCLUDE_DIRS @INCLUDE_INSTALL_DIR@)
endif()
set(LIBSSH_LIRBARY @LIB_INSTALL_DIR@/libssh.so)
set(LIBSSH_LIRBARIES @LIB_INSTALL_DIR@/libssh.so)