Commit fd1cd5d0 authored by Kenneth Moreland's avatar Kenneth Moreland
Browse files

Clean up package configuration files.

Support latest means of loading packages.  Add check for version.
Export targets correctly.
parent aab67975
......@@ -211,7 +211,11 @@ INCLUDE_DIRECTORIES(${ICET_BINARY_DIR}/src/include)
# When creating one of the IceT libraries, we want special instructions
# for building and installing.
SET(ICET_INSTALL_TARGETS "" CACHE STRING "" FORCE)
MACRO(ICET_ADD_LIBRARY library_name)
SET(ICET_INSTALL_TARGETS ${ICET_INSTALL_TARGETS} ${library_name}
CACHE STRING "" FORCE
)
SET(icet_library_sources ${ARGN})
ADD_LIBRARY(${library_name} ${icet_library_sources})
IF (ICET_C_FLAGS_WARN)
......@@ -226,6 +230,11 @@ MACRO(ICET_ADD_LIBRARY library_name)
LIBRARY DESTINATION ${ICET_INSTALL_LIB_DIR} COMPONENT RuntimeLibraries
ARCHIVE DESTINATION ${ICET_INSTALL_LIB_DIR} COMPONENT RuntimeLibraries
)
IF (NOT ICET_INSTALL_NO_DEVELOPMENT)
INSTALL(EXPORT IceTTargets
DESTINATION ${ICET_INSTALL_LIB_DIR}
)
ENDIF (NOT ICET_INSTALL_NO_DEVELOPMENT)
ENDIF(NOT ICET_INSTALL_NO_LIBRARIES)
ENDMACRO(ICET_ADD_LIBRARY)
......@@ -241,44 +250,59 @@ ENDIF (BUILD_TESTING AND ICET_BUILD_TESTING)
ADD_SUBDIRECTORY(doc)
# Save the CMake settings so another project can import them. Loaded by:
# INCLUDE(${CMAKE_ROOT}/Modules/CMakeImportBuildSettings.cmake)
# CMAKE_IMPORT_BUILD_SETTINGS(<build_file>)
INCLUDE(CMakeExportBuildSettings)
CMAKE_EXPORT_BUILD_SETTINGS(${ICET_BINARY_DIR}/ICETBuildSettings.cmake)
INSTALL(FILES ${ICET_BINARY_DIR}/ICETBuildSettings.cmake DESTINATION ${ICET_INSTALL_LIB_DIR})
# Save the library dependency graph for external projects.
EXPORT_LIBRARY_DEPENDENCIES(${ICET_BINARY_DIR}/ICETLibraryDepends.cmake)
INSTALL(FILES ${ICET_BINARY_DIR}/ICETLibraryDepends.cmake DESTINATION ${ICET_INSTALL_LIB_DIR})
# Save the CMake targets so another project can import them.
EXPORT(TARGETS ${ICET_INSTALL_TARGETS}
FILE ${ICET_LIBRARY_DIR}/IceTTargets.cmake
)
# Save IceT specific configuration options.
#First, configuration for build directory.
SET(ICET_INCLUDE_DIRS_CONFIG "${ICET_SOURCE_DIR}/src/include;${ICET_BINARY_DIR}/src/include")
SET(ICET_LIBRARY_DIRS_CONFIG ${ICET_LIBRARY_DIR})
SET(ICET_BUILD_SETTINGS_FILE_CONFIG ${ICET_BINARY_DIR}/ICETBuildSettings.cmake)
SET(ICET_LIBRARY_DEPENDS_FILE ${ICET_BINARY_DIR}/ICETLibraryDepends.cmake)
GET_TARGET_PROPERTY(ICET_LIBRARY_FILE IceTCore LOCATION)
GET_TARGET_PROPERTY(ICET_GL_LIBRARY_FILE IceTGL LOCATION)
GET_TARGET_PROPERTY(ICET_MPI_LIBRARY_FILE IceTMPI LOCATION)
CONFIGURE_FILE(${ICET_SOURCE_DIR}/IceTConfig.cmake.in
${ICET_BINARY_DIR}/IceTConfig.cmake @ONLY IMMEDIATE)
SET(ICET_CORE_LIBRARY_TARGET IceTCore)
IF (ICET_USE_OPENGL)
SET(ICET_GL_LIBRARY_TARGET IceTGL)
ENDIF (ICET_USE_OPENGL)
IF (ICET_USE_MPI)
SET(ICET_MPI_LIBRARY_TARGET IceTMPI)
ENDIF (ICET_USE_MPI)
CONFIGURE_FILE(
${ICET_SOURCE_DIR}/cmake/IceTConfig.cmake.in
${ICET_LIBRARY_DIR}/IceTConfig.cmake
@ONLY IMMEDIATE
)
#Second, configuration for install directory.
SET(ICET_INCLUDE_DIRS_CONFIG ${CMAKE_INSTALL_PREFIX}${ICET_INSTALL_INCLUDE_DIR})
SET(ICET_LIBRARY_DIRS_CONFIG ${CMAKE_INSTALL_PREFIX}${ICET_INSTALL_LIB_DIR})
SET(ICET_BUILD_SETTINGS_FILE_CONFIG
${CMAKE_INSTALL_PREFIX}${ICET_INSTALL_LIB_DIR}/ICETBuildSettings.cmake)
SET(ICET_LIBRARY_DEPENDS_FILE
${CMAKE_INSTALL_PREFIX}${ICET_INSTALL_LIB_DIR}/ICETLibraryDepends.cmake)
GET_FILENAME_COMPONENT(ICET_LIBRARY_FILE "${ICET_LIBRARY_FILE}" NAME)
SET(ICET_LIBRARY_FILE "${CMAKE_INSTALL_PREFIX}${ICET_INSTALL_LIB_DIR}/${ICET_LIBRARY_FILE}")
GET_FILENAME_COMPONENT(ICET_GL_LIBRARY_FILE "${ICET_GL_LIBRARY_FILE}" NAME)
SET(ICET_GL_LIBRARY_FILE "${CMAKE_INSTALL_PREFIX}${ICET_INSTALL_LIB_DIR}/${ICET_GL_LIBRARY_FILE}")
GET_FILENAME_COMPONENT(ICET_MPI_LIBRARY_FILE "${ICET_MPI_LIBRARY_FILE}" NAME)
SET(ICET_MPI_LIBRARY_FILE "${CMAKE_INSTALL_PREFIX}${ICET_INSTALL_LIB_DIR}/${ICET_MPI_LIBRARY_FILE}")
CONFIGURE_FILE(${ICET_SOURCE_DIR}/IceTConfig.cmake.in
${ICET_LIBRARY_DIR}/IceTConfig.cmake @ONLY IMMEDIATE)
INSTALL(FILES ${ICET_LIBRARY_DIR}/IceTConfig.cmake DESTINATION ${ICET_INSTALL_LIB_DIR})
IF (NOT ICET_INSTALL_NO_DEVELOPMENT)
SET(ICET_INCLUDE_DIRS "\${_install_dir}/${ICET_INSTALL_INCLUDE_DIR}")
SET(ICET_CORE_LIBRARY_TARGET IceTCore)
IF (ICET_USE_OPENGL)
SET(ICET_GL_LIBRARY_TARGET IceTGL)
ENDIF (ICET_USE_OPENGL)
IF (ICET_USE_MPI)
SET(ICET_MPI_LIBRARY_TARGET IceTMPI)
ENDIF (ICET_USE_MPI)
CONFIGURE_FILE(
${ICET_SOURCE_DIR}/cmake/IceTConfig.cmake.in
${ICET_LIBRARY_DIR}/IceTConfig.cmake.install
@ONLY IMMEDIATE)
INSTALL(FILES ${ICET_LIBRARY_DIR}/IceTConfig.cmake.install
DESTINATION ${ICET_INSTALL_LIB_DIR}
RENAME IceTConfig.cmake
)
ENDIF (NOT ICET_INSTALL_NO_DEVELOPMENT)
# Create supplemental version configuration file.
CONFIGURE_FILE(
${ICET_SOURCE_DIR}/cmake/IceTConfigVersion.cmake.in
${ICET_LIBRARY_DIR}/IceTConfigVersion.cmake
@ONLY
)
IF (NOT ICET_INSTALL_NO_DEVELOPMENT)
INSTALL(FILES ${ICET_LIBRARY_DIR}/IceTConfigVersion.cmake
DESTINATION ${ICET_INSTALL_LIB_DIR}
)
ENDIF (NOT ICET_INSTALL_NO_DEVELOPMENT)
# Enable CPack packaging.
SET(CPACK_PACKAGE_DESCRIPTION_FILE ${ICET_SOURCE_DIR}/README)
......
......@@ -12,28 +12,31 @@
# This source code is released under the New BSD License.
#
# The IceT include file directories.
SET(ICET_INCLUDE_DIRS "@ICET_INCLUDE_DIRS_CONFIG@")
# This file should be installed in the lib directory. Find the root directory.
GET_FILENAME_COMPONENT(_dir "${CMAKE_CURRENT_LIST_FILE}" PATH)
GET_FILENAME_COMPONENT(_install_dir "${_dir}/.." ABSOLUTE)
# The IceT library directories.
SET(ICET_LIBRARY_DIRS "@ICET_LIBRARY_DIRS_CONFIG@")
# Load the targets include (next to this one).
INCLUDE("${_dir}/IceTTargets.cmake")
# The C and C++ flags added by IceT to the cmake-configured flags.
SET(ICET_REQUIRED_C_FLAGS "@ICET_REQUIRED_C_FLAGS@")
SET(ICET_REQUIRED_CXX_FLAGS "@ICET_REQUIRED_CXX_FLAGS@")
# The IceT include file directories.
SET(ICET_INCLUDE_DIRS "@ICET_INCLUDE_DIRS_CONFIG@")
# The IceT version number
SET(ICET_MAJOR_VERSION "@ICET_MAJOR_VERSION@")
SET(ICET_MINOR_VERSION "@ICET_MINOR_VERSION@")
SET(ICET_PATCH_VERSION "@ICET_PATCH_VERSION@")
SET(ICET_VERSION "@ICET_VERSION@")
# The build settings file.
SET(ICET_BUILD_SETTINGS_FILE "@ICET_BUILD_SETTINGS_FILE_CONFIG@")
# Main IceT configuration options
SET(ICET_USE_OPENGL "@ICET_USE_OPENGL@")
SET(ICET_USE_MPI "@ICET_USE_MPI@")
SET(ICET_BUILD_SHARED_LIBS "@ICET_BUILD_SHARED_LIBS@")
# The IceT libraries
SET(ICET_CORE_LIBS "@ICET_LIBRARY_FILE@")
SET(ICET_GL_LIBS "@ICET_GL_LIBRARY_FILE@")
SET(ICET_MPI_LIBS "@ICET_MPI_LIBRARY_FILE@")
SET(ICET_CORE_LIBS "@ICET_CORE_LIBRARY_TARGET@")
SET(ICET_GL_LIBS "@ICET_GL_LIBRARY_TARGET@")
SET(ICET_MPI_LIBS "@ICET_MPI_LIBRARY_TARGET@")
# MPI configuration used to build IceT.
SET(ICET_MPI_INCLUDE_PATH "@MPI_INCLUDE_PATH@")
......@@ -44,12 +47,3 @@ SET(ICET_MPI_MAX_NUMPROCS "@ICET_MPI_MAX_NUMPROCS@")
SET(ICET_MPI_PREFLAGS "@ICET_MPI_PREFLAGS@")
SET(ICET_MPI_POSTFLAGS "@ICET_MPI_POSTFLAGS@")
# Other IceT configuration options.
SET(ICET_BUILD_SHARED_LIBS "@BUILD_SHARED_LIBS@")
SET(ICET_BUILD_TESTING "@BUILD_TESTING@")
# The ICET library dependencies.
IF(NOT ICET_NO_LIBRARY_DEPENDS)
INCLUDE("@ICET_LIBRARY_DEPENDS_FILE@")
ENDIF(NOT ICET_NO_LIBRARY_DEPENDS)
set(PACKAGE_VERSION "@ICET_VERSION@")
if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")
set(PACKAGE_VERSION_COMPATIBLE FALSE)
else()
set(PACKAGE_VERSION_COMPATIBLE TRUE)
if ("${PACKAGE_VERSION}" STREQUAL "${PACKAGE_FIND_VERSION}")
set(PACKAGE_VERSION_EXACT TRUE)
endif()
endif()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment