Commit 1748e8db authored by Robert Maynard's avatar Robert Maynard

Update the SMTKConfig to find MOAB and Remus if needed.

parent 995d33bb
......@@ -41,8 +41,15 @@ if(MOAB_FOUND)
#Because we have a built-in moab the config.cmake
#will fail to include targets.cmake so we must do it
#manually
include(${MOAB_ROOT_DIR}/lib/MOABConfig.cmake)
include(${MOAB_ROOT_DIR}/lib/MOABTargets.cmake)
if(SMTK_USE_SYSTEM_MOAB)
include(${MOAB_ROOT_DIR}/lib/MOABConfig.cmake)
include(${MOAB_ROOT_DIR}/lib/MOABTargets.cmake)
else()
#otherwise we are use the third-party bundled version
#and nothing else needs to be done
include(MOABConfig.cmake)
include(MOABTargets.cmake)
endif()
set_target_properties(MOAB PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${MOAB_INCLUDE_DIR}"
......
#setup if we are being included from the build directory of SMTK
set(SMTK_IN_BUILD_DIR @SMTK_IN_BUILD_DIR@)
#Setup the CMake module paths
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "@SMTK_MODULE_DIR@")
#First thing to find is MOAB. Even when moab is built-in we install the
#MOAB package.
set(SMTK_USE_SYSTEM_MOAB @SMTK_USE_SYSTEM_MOAB@)
#Only dont find SMTK when in BUILD_DIR and not using system
if(SMTK_IN_BUILD_DIR)
if(SMTK_USE_SYSTEM_MOAB)
find_package(MOAB REQUIRED)
endif()
else()
find_package(MOAB REQUIRED)
endif()
set(SMTK_ENABLE_REMUS_SUPPORT @SMTK_ENABLE_REMUS_SUPPORT@)
if(SMTK_ENABLE_REMUS_SUPPORT)
find_package(Remus REQUIRED)
endif()
include("@SMTK_CONFIG_DIR@/SMTKTargets.cmake")
\ No newline at end of file
......@@ -95,7 +95,7 @@ function(smtk_install_library target)
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
export(TARGETS ${target} APPEND FILE ${SMTK_BINARY_DIR}/SMTKConfig.cmake)
export(TARGETS ${target} APPEND FILE ${SMTK_BINARY_DIR}/SMTKTargets.cmake)
endfunction(smtk_install_library)
#generate an export header and create an install target for it
......
......@@ -10,12 +10,12 @@ if (POLICY CMP0054)
cmake_policy(SET CMP0054 OLD)
endif()
# Remove SMTKConfig.cmake at the beginning of each CMake run; each time
project(SMTK)
# Remove SMTKTargets.cmake at the beginning of each CMake run; each time
# a library is declared below, the file is appended and we do not want
# to keep appending over multiple runs.
file(REMOVE SMTKConfig.cmake)
project(SMTK)
file(REMOVE ${PROJECT_BINARY_DIR}/SMTKTargets.cmake)
################################################################################
# SMTK version number
......@@ -397,6 +397,17 @@ install(
lib/cmake/SMTK
)
# Install find modules for SMTK needs to find external packages:
install(
FILES
${PROJECT_SOURCE_DIR}/CMake/FindCGM.cmake
${PROJECT_SOURCE_DIR}/CMake/FindMoab.cmake
${PROJECT_SOURCE_DIR}/CMake/FindRemus.cmake
${PROJECT_SOURCE_DIR}/CMake/FindZeroMQ.cmake
DESTINATION
lib/cmake/SMTK
)
################################################################################
# Build third party libraries
################################################################################
......@@ -458,6 +469,32 @@ endif()
install(
EXPORT SMTK
DESTINATION lib/cmake/SMTK
FILE SMTKConfig.cmake
FILE SMTKTargets.cmake
)
export(PACKAGE SMTK)
# Setup the config file for exports that stores what other thirdparty
# packages we need to search for ( MOAB, Remus, etc ) for when using the
# build version of smtk
set(SMTK_IN_BUILD_DIR "TRUE")
set(SMTK_MODULE_DIR "${SMTK_SOURCE_DIR}/CMake")
set(SMTK_CONFIG_DIR "${PROJECT_BINARY_DIR}")
configure_file(
${PROJECT_SOURCE_DIR}/CMake/SMTKConfig.cmake.in
${PROJECT_BINARY_DIR}/SMTKConfig.cmake
@ONLY)
# Setup the config file for exports that stores what other thirdparty
# packages we need to search for ( MOAB, Remus, etc ) for when using the
# install version of smtk
set(SMTK_IN_BUILD_DIR "FALSE")
set(SMTK_MODULE_DIR "\${CMAKE_CURRENT_LIST_DIR};\${CMAKE_CURRENT_LIST_DIR}/../MOAB")
set(SMTK_CONFIG_DIR "\${CMAKE_CURRENT_LIST_DIR}")
configure_file(
${PROJECT_SOURCE_DIR}/CMake/SMTKConfig.cmake.in
${PROJECT_BINARY_DIR}/CMakeFiles/SMTKConfig.cmake
@ONLY)
install (FILES ${PROJECT_BINARY_DIR}/CMakeFiles/SMTKConfig.cmake
DESTINATION lib/cmake/SMTK)
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