From 2429043f14c6a6f529f59c61cdf7193bc3c13b8c Mon Sep 17 00:00:00 2001 From: malaterre Date: Fri, 5 May 2006 20:34:47 +0000 Subject: [PATCH] ENH: Gather the installation stuff in one place --- CMake/CMakeLists.txt | 27 +++++++++ CMake/GDCMConfig.cmake.in | 117 ++++++++++++++++++++++++++++++++++++++ CMake/UseGDCM.cmake | 50 ++++++++++++++++ CMakeLists.txt | 26 --------- 4 files changed, 194 insertions(+), 26 deletions(-) create mode 100644 CMake/CMakeLists.txt create mode 100644 CMake/GDCMConfig.cmake.in create mode 100644 CMake/UseGDCM.cmake diff --git a/CMake/CMakeLists.txt b/CMake/CMakeLists.txt new file mode 100644 index 00000000..e0970553 --- /dev/null +++ b/CMake/CMakeLists.txt @@ -0,0 +1,27 @@ +#----------------------------------------------------------------------------- +# Help outside projects link against gdcm + +EXPORT_LIBRARY_DEPENDENCIES(${GDCM_BINARY_DIR}/GDCMLibraryDepends.cmake) + +# Save the compiler settings so another project can import them. +INCLUDE(${CMAKE_ROOT}/Modules/CMakeExportBuildSettings.cmake) +CMAKE_EXPORT_BUILD_SETTINGS(${GDCM_BINARY_DIR}/GDCMBuildSettings.cmake) +#INSTALL_FILES(/lib/gdcm .cmake GDCMBuildSettings) + +# For GDCM from build tree: +SET(GDCM_USE_FILE ${GDCM_SOURCE_DIR}/GDCMUse.cmake) +SET(GDCM_INCLUDE_DIRS + ${GDCM_BINARY_DIR}/ #for gdcmConfigure.h + ${GDCM_SOURCE_DIR}/src #for main gdcm include + ) +SET(GDCM_LIBRARY_DIRS ${LIBRARY_OUTPUT_PATH}) +SET(GDCM_LIBRARY_DEPENDS_FILE ${GDCM_BINARY_DIR}/GDCMLibraryDepends.cmake) + +# For installed GDCM: +SET(GDCM_USE_FILE ${CMAKE_INSTALL_PREFIX}/lib/GDCM-${GDCM_VERSION}/GDCMUse.cmake) +SET(GDCM_INCLUDE_DIRS ${CMAKE_INSTALL_PREFIX}/include/GDCM-${GDCM_VERSION}) +SET(GDCM_LIBRARY_DIRS ${CMAKE_INSTALL_PREFIX}/lib/GDCM-${GDCM_VERSION}) +SET(GDCM_LIBRARY_DEPENDS_FILE ${CMAKE_INSTALL_PREFIX}/lib/GDCM-${GDCM_VERSION}/GDCMLibraryDepends.cmake) +CONFIGURE_FILE(${GDCM_SOURCE_DIR}/GDCMConfig.cmake.in + ${GDCM_BINARY_DIR}/GDCMConfig.cmake @ONLY IMMEDIATE) + diff --git a/CMake/GDCMConfig.cmake.in b/CMake/GDCMConfig.cmake.in new file mode 100644 index 00000000..d4e7d54b --- /dev/null +++ b/CMake/GDCMConfig.cmake.in @@ -0,0 +1,117 @@ +#----------------------------------------------------------------------------- +# +# KWWidgetsConfig.cmake - CMake configuration file for external projects. +# +# This file is configured by KWWidgets and used by the UseKWWidgets.cmake +# module to load KWWidgets's settings for an external project. +@KWWidgets_CONFIG_INSTALL_ONLY@ +# The KWWidgets version number. +SET(KWWidgets_MAJOR_VERSION "@KWWidgets_MAJOR_VERSION@") +SET(KWWidgets_MINOR_VERSION "@KWWidgets_MINOR_VERSION@") + +# The libraries. +SET(KWWidgets_LIBRARIES "@KWWidgets_LIBRARIES@") + +# The list of available languages. +SET(KWWidgets_LANGUAGES "TCL") + +# The CMake macros dir. +SET(KWWidgets_CMAKE_DIR "@KWWidgets_CMAKE_DIR_CONFIG@") + +# The configuration options. +SET(KWWidgets_BUILD_SHARED_LIBS "@KWWidgets_BUILD_SHARED_LIBS@") +SET(KWWidgets_USE_HTML_HELP "@KWWidgets_USE_HTML_HELP@") +SET(KWWidgets_USE_INTERNATIONALIZATION "@KWWidgets_USE_INTERNATIONALIZATION@") + +# The C and C++ flags added to the cmake-configured flags. +SET(KWWidgets_REQUIRED_C_FLAGS + "@KWWidgets_REQUIRED_C_FLAGS@") +SET(KWWidgets_REQUIRED_CXX_FLAGS + "@KWWidgets_REQUIRED_CXX_FLAGS@") +SET(KWWidgets_REQUIRED_EXE_LINKER_FLAGS + "@KWWidgets_REQUIRED_EXE_LINKER_FLAGS@") +SET(KWWidgets_REQUIRED_SHARED_LINKER_FLAGS + "@KWWidgets_REQUIRED_SHARED_LINKER_FLAGS@") +SET(KWWidgets_REQUIRED_MODULE_LINKER_FLAGS + "@KWWidgets_REQUIRED_MODULE_LINKER_FLAGS@") + +# The "use" file. +SET(KWWidgets_USE_FILE "@KWWidgets_USE_FILE_CONFIG@") + +# The build settings file. +SET(KWWidgets_BUILD_SETTINGS_FILE "@KWWidgets_BUILD_SETTINGS_FILE_CONFIG@") + +# The library directories. +SET(KWWidgets_LIBRARY_DIRS "@KWWidgets_LIBRARY_DIRS_CONFIG@") + +# The runtime directories. +# Note that if KWWidgets_CONFIGURATION_TYPES is set (see below) then +# these directories will be the parent directories under which there will +# be a directory of runtime binaries for each configuration type. +SET(KWWidgets_RUNTIME_DIRS "@KWWidgets_RUNTIME_DIRS_CONFIG@") + +# The include directories. +SET(KWWidgets_INCLUDE_DIRS "@KWWidgets_INCLUDE_DIRS_CONFIG@") + +# The library dependencies file. +IF(NOT KWWidgets_NO_LIBRARY_DEPENDS) + INCLUDE("@KWWidgets_LIBRARY_DEPENDS_FILE@") +ENDIF(NOT KWWidgets_NO_LIBRARY_DEPENDS) + +# The examples dir. +SET(KWWidgets_EXAMPLES_DIR "@KWWidgets_EXAMPLES_DIR_CONFIG@") + +# The templates dir. +SET(KWWidgets_TEMPLATES_DIR "@KWWidgets_TEMPLATES_DIR_CONFIG@") + +# The resources dir. +SET(KWWidgets_RESOURCES_DIR "@KWWidgets_RESOURCES_DIR_CONFIG@") +SET(KWWidgets_RESOURCE_MAJOR_VERSION + "@KWWidgets_RESOURCE_MAJOR_VERSION@") +SET(KWWidgets_RESOURCE_MINOR_VERSION + "@KWWidgets_RESOURCE_MINOR_VERSION@") +SET(KWWidgets_RESOURCE_APPLICATION_NAME + "@KWWidgets_RESOURCE_APPLICATION_NAME@") +SET(KWWidgets_RESOURCE_FILE_NAME + "@KWWidgets_RESOURCE_FILE_NAME@") +SET(KWWidgets_RESOURCE_COMPANY_NAME + "@KWWidgets_RESOURCE_COMPANY_NAME@") + +# The Tcl/Tk options. +SET(KWWidgets_TCL_PACKAGE_INDEX_DIR + "@KWWidgets_TCL_PACKAGE_INDEX_DIR_CONFIG@") + +# The Tcl/Tk options. +SET(KWWidgets_TCL_PACKAGE_INDEX_DIR + "@KWWidgets_TCL_PACKAGE_INDEX_DIR_CONFIG@") + +# The Python options. +SET(KWWidgets_PYTHON_MODULE_DIR + "@KWWidgets_PYTHON_MODULE_DIR_CONFIG@") + +# The Doxygen options. +SET(KWWidgets_DOXYGEN_DIR "@KWWidgets_DOXYGEN_DIR_CONFIG@") + +# The VTK options. +SET(KWWidgets_VTK_DIR "@KWWidgets_VTK_DIR_CONFIG@") + +# The gettext library. This is only defined for build dirs to help projects +# find the gettext library (it is safe to assume we are on the same machine; +# we could not guarantee that if we are building against an installed +# KWWidgets though). +SET(GETTEXT_SEARCH_PATH ${GETTEXT_SEARCH_PATH} "@GETTEXT_SEARCH_PATH_CONFIG@") + +# An install tree always provides one build configuration. +# A build tree may provide either one or multiple build +# configurations depending on the CMake generator used. Since +# this project can be used either from a build tree or an install tree it +# is useful for outside projects to know the configurations available. +# If this KWWidgetsConfig.cmake is in an install tree +# KWWidgets_CONFIGURATION_TYPES will be empty and KWWidgets_BUILD_TYPE +# will be set to the value of CMAKE_BUILD_TYPE used to build +# KWWidgets. If KWWidgetsConfig.cmake is in a build tree +# then KWWidgets_CONFIGURATION_TYPES and KWWidgets_BUILD_TYPE will +# have values matching CMAKE_CONFIGURATION_TYPES and CMAKE_BUILD_TYPE +# for that build tree (only one will ever be set). +SET(KWWidgets_CONFIGURATION_TYPES @KWWidgets_CONFIGURATION_TYPES_CONFIG@) +SET(KWWidgets_BUILD_TYPE @KWWidgets_BUILD_TYPE_CONFIG@) diff --git a/CMake/UseGDCM.cmake b/CMake/UseGDCM.cmake new file mode 100644 index 00000000..26ae8c73 --- /dev/null +++ b/CMake/UseGDCM.cmake @@ -0,0 +1,50 @@ +# +# This module is provided as KWWidgets_USE_FILE by KWWidgetsConfig.cmake. +# It can be INCLUDEd in a project to load the needed compiler and linker +# settings to use KWWidgets: +# FIND_PACKAGE(KWWidgets REQUIRED) +# INCLUDE(${KWWidgets_USE_FILE}) +# + +IF(NOT KWWidgets_USE_FILE_INCLUDED) + SET(KWWidgets_USE_FILE_INCLUDED 1) + + # Load the compiler settings used for KWWidgets. + IF(KWWidgets_BUILD_SETTINGS_FILE) + INCLUDE(${CMAKE_ROOT}/Modules/CMakeImportBuildSettings.cmake) + CMAKE_IMPORT_BUILD_SETTINGS(${KWWidgets_BUILD_SETTINGS_FILE}) + ENDIF(KWWidgets_BUILD_SETTINGS_FILE) + + # Add compiler flags needed to use KWWidgets. + SET(CMAKE_C_FLAGS + "${CMAKE_C_FLAGS} ${KWWidgets_REQUIRED_C_FLAGS}") + SET(CMAKE_CXX_FLAGS + "${CMAKE_CXX_FLAGS} ${KWWidgets_REQUIRED_CXX_FLAGS}") + SET(CMAKE_EXE_LINKER_FLAGS + "${CMAKE_EXE_LINKER_FLAGS} ${KWWidgets_REQUIRED_EXE_LINKER_FLAGS}") + SET(CMAKE_SHARED_LINKER_FLAGS + "${CMAKE_SHARED_LINKER_FLAGS} ${KWWidgets_REQUIRED_SHARED_LINKER_FLAGS}") + SET(CMAKE_MODULE_LINKER_FLAGS + "${CMAKE_MODULE_LINKER_FLAGS} ${KWWidgets_REQUIRED_MODULE_LINKER_FLAGS}") + + # Add include directories needed to use KWWidgets. + INCLUDE_DIRECTORIES(${KWWidgets_INCLUDE_DIRS}) + + # Add link directories needed to use KWWidgets. + LINK_DIRECTORIES(${KWWidgets_LIBRARY_DIRS}) + + # Add cmake module path. + SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${KWWidgets_CMAKE_DIR}") + + # Use VTK. + IF(NOT KWWidgets_NO_USE_VTK) + SET(VTK_DIR ${KWWidgets_VTK_DIR}) + FIND_PACKAGE(VTK) + IF(VTK_FOUND) + INCLUDE(${VTK_USE_FILE}) + ELSE(VTK_FOUND) + MESSAGE("VTK not found in KWWidgets_VTK_DIR=\"${KWWidgets_VTK_DIR}\".") + ENDIF(VTK_FOUND) + ENDIF(NOT KWWidgets_NO_USE_VTK) + +ENDIF(NOT KWWidgets_USE_FILE_INCLUDED) diff --git a/CMakeLists.txt b/CMakeLists.txt index 47d3d3ff..127a55b0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,32 +35,6 @@ SET (EXECUTABLE_OUTPUT_PATH ${GDCM_BINARY_DIR}/bin CACHE PATH "Single output dir SET (LIBRARY_OUTPUT_PATH ${GDCM_BINARY_DIR}/bin CACHE PATH "Single output directory for building all libraries.") MARK_AS_ADVANCED(LIBRARY_OUTPUT_PATH EXECUTABLE_OUTPUT_PATH) -#----------------------------------------------------------------------------- -# Help outside projects link against gdcm - -EXPORT_LIBRARY_DEPENDENCIES(${GDCM_BINARY_DIR}/GDCMLibraryDepends.cmake) - -# Save the compiler settings so another project can import them. -INCLUDE(${CMAKE_ROOT}/Modules/CMakeExportBuildSettings.cmake) -CMAKE_EXPORT_BUILD_SETTINGS(${GDCM_BINARY_DIR}/GDCMBuildSettings.cmake) -#INSTALL_FILES(/lib/gdcm .cmake GDCMBuildSettings) - -# For GDCM from build tree: -SET(GDCM_USE_FILE ${GDCM_SOURCE_DIR}/GDCMUse.cmake) -SET(GDCM_INCLUDE_DIRS - ${GDCM_BINARY_DIR}/ #for gdcmConfigure.h - ${GDCM_SOURCE_DIR}/src #for main gdcm include - ) -SET(GDCM_LIBRARY_DIRS ${LIBRARY_OUTPUT_PATH}) -SET(GDCM_LIBRARY_DEPENDS_FILE ${GDCM_BINARY_DIR}/GDCMLibraryDepends.cmake) - -# For installed GDCM: -SET(GDCM_USE_FILE ${CMAKE_INSTALL_PREFIX}/lib/GDCM-${GDCM_VERSION}/GDCMUse.cmake) -SET(GDCM_INCLUDE_DIRS ${CMAKE_INSTALL_PREFIX}/include/GDCM-${GDCM_VERSION}) -SET(GDCM_LIBRARY_DIRS ${CMAKE_INSTALL_PREFIX}/lib/GDCM-${GDCM_VERSION}) -SET(GDCM_LIBRARY_DEPENDS_FILE ${CMAKE_INSTALL_PREFIX}/lib/GDCM-${GDCM_VERSION}/GDCMLibraryDepends.cmake) -CONFIGURE_FILE(${GDCM_SOURCE_DIR}/GDCMConfig.cmake.in - ${GDCM_BINARY_DIR}/GDCMConfig.cmake @ONLY IMMEDIATE) #----------------------------------------------------------------------------- # Test if compiler defines the pseudo-macro __FUNCTION__ -- 2.45.1