Commit 89584c78 authored by Atkins, Charles Vernon's avatar Atkins, Charles Vernon Committed by GitHub
Browse files

Merge pull request #199 from chuckatkins/add-package-configs

Add cmake package configs
parents 1a91dd77 877087db
...@@ -17,8 +17,8 @@ project(ADIOS2 VERSION 2.0.0) ...@@ -17,8 +17,8 @@ project(ADIOS2 VERSION 2.0.0)
#------------------------------------------------------------------------------# #------------------------------------------------------------------------------#
# Some boilerplate to setup nice output directories # Some boilerplate to setup nice output directories
#------------------------------------------------------------------------------# #------------------------------------------------------------------------------#
include(GNUInstallDirs) include(GNUInstallDirs)
set(CMAKE_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/adios2")
list(INSERT CMAKE_MODULE_PATH 0 "${ADIOS2_SOURCE_DIR}/cmake") list(INSERT CMAKE_MODULE_PATH 0 "${ADIOS2_SOURCE_DIR}/cmake")
if(NOT CMAKE_ARCHIVE_OUTPUT_DIRECTORY) if(NOT CMAKE_ARCHIVE_OUTPUT_DIRECTORY)
...@@ -55,14 +55,19 @@ include(CMakeDependentOption) ...@@ -55,14 +55,19 @@ include(CMakeDependentOption)
# Setup shared library / -fPIC stuff # Setup shared library / -fPIC stuff
get_property(SHARED_LIBS_SUPPORTED GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS) get_property(SHARED_LIBS_SUPPORTED GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS)
cmake_dependent_option(ADIOS2_BUILD_SHARED_LIBS option(BUILD_SHARED_LIBS "Build shared libraries (so/dylib/dll)." ${SHARED_LIBS_SUPPORTED})
"Whether or not to build shared libraries" ON if(NOT SHARED_LIBS_SUPPORTED)
"SHARED_LIBS_SUPPORTED" OFF) if(BUILD_SHARED_LIBS)
message(WARNING "A shared library build was requested but is not supported on this platform / compiler. Unexpected build results will likely occur")
endif()
set(BUILD_SHARED_LIBS OFF CACHE BOOL
"Build shared libraries (so/dylib/dll)." FORCE
)
endif()
cmake_dependent_option(ADIOS2_ENABLE_PIC cmake_dependent_option(ADIOS2_ENABLE_PIC
"Build with Position Independent Code" ON "Build with Position Independent Code" ON
"SHARED_LIBS_SUPPORTED" OFF) "SHARED_LIBS_SUPPORTED" OFF)
set(BUILD_SHARED_LIBS ${ADIOS2_BUILD_SHARED_LIBS})
if(ADIOS2_ENABLE_PIC) if(ADIOS2_ENABLE_PIC)
set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON)
endif() endif()
...@@ -83,9 +88,8 @@ if(ADIOS2_HAVE_MPI) ...@@ -83,9 +88,8 @@ if(ADIOS2_HAVE_MPI)
add_definitions(-DOMPI_SKIP_MPICXX) add_definitions(-DOMPI_SKIP_MPICXX)
endif() endif()
GenerateADIOSConfig(MPI ZFP BZip2 ADIOS1 HDF5 DataMan Python SysVShMem) GenerateADIOSHeaderConfig(MPI ZFP BZip2 ADIOS1 HDF5 DataMan Python SysVShMem)
install( install(FILES ${ADIOS2_BINARY_DIR}/source/adios2/ADIOSConfig.h
FILES ${ADIOS2_BINARY_DIR}/adios2/ADIOSConfig.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/adios2 DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/adios2
) )
...@@ -125,6 +129,11 @@ if(BUILD_TESTING) ...@@ -125,6 +129,11 @@ if(BUILD_TESTING)
add_subdirectory(testing) add_subdirectory(testing)
endif() endif()
#------------------------------------------------------------------------------#
# Generating package configs
#------------------------------------------------------------------------------#
GenerateADIOSPackageConfig()
#------------------------------------------------------------------------------# #------------------------------------------------------------------------------#
# Configuration summary # Configuration summary
#------------------------------------------------------------------------------# #------------------------------------------------------------------------------#
......
...@@ -28,14 +28,11 @@ endif() ...@@ -28,14 +28,11 @@ endif()
string(REGEX REPLACE "^${PYTHON_PREFIX}/" "" string(REGEX REPLACE "^${PYTHON_PREFIX}/" ""
CMAKE_INSTALL_PYTHONDIR "${PYTHON_SITE_PACKAGES}" CMAKE_INSTALL_PYTHONDIR "${PYTHON_SITE_PACKAGES}"
) )
set(CMAKE_INSTALL_PYTHONDIR "${CMAKE_INSTALL_PYTHONDIR}"
CACHE INTERNAL "" FORCE
)
set_target_properties(adios2py PROPERTIES set_target_properties(adios2py PROPERTIES
OUTPUT_NAME adios2 OUTPUT_NAME adios2
LIBRARY_OUTPUT_DIRECTORY ${ADIOS2_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR} LIBRARY_OUTPUT_DIRECTORY ${ADIOS2_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}
RUNTIME_OUTPUT_DIRECTORY ${ADIOS2_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR} RUNTIME_OUTPUT_DIRECTORY ${ADIOS2_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}
) )
install(TARGETS adios2py install(TARGETS adios2py
DESTINATION ${CMAKE_INSTALL_PYTHONDIR} DESTINATION ${CMAKE_INSTALL_PYTHONDIR}
) )
list(INSERT CMAKE_MODULE_PATH 0 "@ADIOS2_SOURCE_DIR@/cmake")
include("${CMAKE_CURRENT_LIST_DIR}/ADIOS2ConfigCommon.cmake")
cmake_minimum_required(VERSION 3.5)
include(CMakeFindDependencyMacro)
if(NOT @BUILD_SHARED_LIBS@)
set(ADIOS2_HAVE_BZip2 @ADIOS2_HAVE_BZip2@)
if(ADIOS2_HAVE_BZip2)
find_dependency(BZip2)
endif()
set(ADIOS2_HAVE_ZFP @ADIOS2_HAVE_ZFP@)
if(ADIOS2_HAVE_ZFP)
find_dependency(ZFP)
endif()
set(ADIOS2_HAVE_MPI @ADIOS2_HAVE_MPI@)
if(ADIOS2_HAVE_MPI)
find_dependency(MPI)
endif()
set(ADIOS2_HAVE_ZeroMQ @ADIOS2_HAVE_ZeroMQ@)
if(ADIOS2_HAVE_ZeroMQ)
find_dependency(ZeroMQ)
endif()
set(ADIOS2_HAVE_HDF5 @ADIOS2_HAVE_HDF5@)
if(ADIOS2_HAVE_HDF5)
find_dependency(HDF5 COMPONENTS C)
endif()
set(ADIOS2_HAVE_ADIOS1 @ADIOS2_HAVE_ADIOS1@)
if(ADIOS2_HAVE_ADIOS1)
if(ADIOS2_HAVE_MPI)
find_dependency(ADIOS1 1.12.0)
else()
find_dependency(ADIOS1 1.12.0 sequential)
endif()
endif()
endif()
include("${CMAKE_CURRENT_LIST_DIR}/ADIOS2ConfigVersion.cmake")
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(ADIOS2 DEFAULT_MESSAGE ADIOS2_VERSION)
include("${CMAKE_CURRENT_LIST_DIR}/ADIOS2Targets.cmake")
list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_CURRENT_LIST_DIR}/Modules")
include("${CMAKE_CURRENT_LIST_DIR}/ADIOS2ConfigCommon.cmake")
...@@ -3,22 +3,6 @@ ...@@ -3,22 +3,6 @@
# accompanying file Copyright.txt for details. # accompanying file Copyright.txt for details.
#------------------------------------------------------------------------------# #------------------------------------------------------------------------------#
function(GenerateADIOSConfig)
foreach(OPT IN LISTS ARGN)
string(TOUPPER ${OPT} OPT_UPPER)
if(ADIOS2_HAVE_${OPT})
set(ADIOS2_HAVE_${OPT_UPPER} 1)
else()
set(ADIOS2_HAVE_${OPT_UPPER})
endif()
endforeach()
configure_file(
${ADIOS2_SOURCE_DIR}/source/adios2/ADIOSConfig.h.in
${ADIOS2_BINARY_DIR}/adios2/ADIOSConfig.h
)
endfunction()
function(adios_option name description default) function(adios_option name description default)
set(ADIOS2_USE_${name} ${default} CACHE STRING "${description}") set(ADIOS2_USE_${name} ${default} CACHE STRING "${description}")
set_property(CACHE ADIOS2_USE_${name} PROPERTY set_property(CACHE ADIOS2_USE_${name} PROPERTY
...@@ -46,3 +30,92 @@ function(python_add_test name script) ...@@ -46,3 +30,92 @@ function(python_add_test name script)
ENVIRONMENT "PYTHONPATH=${ADIOS2_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}:$ENV{PYTHONPATH}" ENVIRONMENT "PYTHONPATH=${ADIOS2_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}:$ENV{PYTHONPATH}"
) )
endfunction() endfunction()
function(GenerateADIOSHeaderConfig)
foreach(OPT IN LISTS ARGN)
string(TOUPPER ${OPT} OPT_UPPER)
if(ADIOS2_HAVE_${OPT})
set(ADIOS2_HAVE_${OPT_UPPER} 1)
else()
set(ADIOS2_HAVE_${OPT_UPPER})
endif()
endforeach()
configure_file(
${ADIOS2_SOURCE_DIR}/source/adios2/ADIOSConfig.h.in
${ADIOS2_BINARY_DIR}/source/adios2/ADIOSConfig.h
)
endfunction()
function(GenerateADIOSPackageConfig)
include(CMakePackageConfigHelpers)
# Build interface configs
write_basic_package_version_file(
${ADIOS2_BINARY_DIR}/ADIOS2ConfigVersion.cmake
COMPATIBILITY AnyNewerVersion
)
export(EXPORT adios2Exports
FILE ${ADIOS2_BINARY_DIR}/ADIOS2Targets.cmake
NAMESPACE adios2::
)
configure_file(
${ADIOS2_SOURCE_DIR}/cmake/ADIOS2ConfigCommon.cmake.in
${ADIOS2_BINARY_DIR}/ADIOS2ConfigCommon.cmake
@ONLY
)
configure_file(
${ADIOS2_SOURCE_DIR}/cmake/ADIOS2Config.cmake.in
${ADIOS2_BINARY_DIR}/ADIOS2Config.cmake
@ONLY
)
# Install interface configs
install(
FILES
${ADIOS2_BINARY_DIR}/ADIOS2ConfigVersion.cmake
${ADIOS2_BINARY_DIR}/ADIOS2ConfigCommon.cmake
DESTINATION ${CMAKE_INSTALL_CMAKEDIR}
)
install(EXPORT adios2Exports
FILE ADIOS2Targets.cmake
NAMESPACE adios2::
DESTINATION ${CMAKE_INSTALL_CMAKEDIR}
)
configure_file(
${ADIOS2_SOURCE_DIR}/cmake/ADIOS2ConfigInstall.cmake.in
${ADIOS2_BINARY_DIR}/ADIOS2ConfigInstall.cmake
@ONLY
)
install(FILES ${ADIOS2_BINARY_DIR}/ADIOS2ConfigInstall.cmake
RENAME ADIOS2Config.cmake
DESTINATION ${CMAKE_INSTALL_CMAKEDIR}
)
# Install helper find modules if needed
if(NOT BUILD_SHARED_LIBS)
if(ADIOS2_HAVE_BZip2)
install(FILES cmake/FindBZip2.cmake
DESTINATION ${CMAKE_INSTALL_CMAKEDIR}/Modules
)
install(FILES cmake/upstream/FindBZip2.cmake
DESTINATION ${CMAKE_INSTALL_CMAKEDIR}/Modules/upstream
)
endif()
if(ADIOS2_HAVE_ZFP)
install(FILES cmake/FindZFP.cmake
DESTINATION ${CMAKE_INSTALL_CMAKEDIR}/Modules
)
endif()
if(ADIOS2_HAVE_ZeroMQ)
install(FILES cmake/FindZeroMQ.cmake
DESTINATION ${CMAKE_INSTALL_CMAKEDIR}/Modules
)
endif()
if(ADIOS2_HAVE_ADIOS1)
install(FILES cmake/FindADIOS1.cmake
DESTINATION ${CMAKE_INSTALL_CMAKEDIR}/Modules
)
endif()
endif()
endfunction()
...@@ -3,6 +3,10 @@ ...@@ -3,6 +3,10 @@
# accompanying file Copyright.txt for details. # accompanying file Copyright.txt for details.
#------------------------------------------------------------------------------# #------------------------------------------------------------------------------#
# We'll need to install the private find modules to ensure our import libs
# are properly resovled
set(adios2_find_modules)
# This file contains the option and dependency logic. The configuration # This file contains the option and dependency logic. The configuration
# options are designed to be tertiary: ON, OFF, or AUTO. If AUTO, we try to # options are designed to be tertiary: ON, OFF, or AUTO. If AUTO, we try to
# determine if dependencies are available and enable the option if we find # determine if dependencies are available and enable the option if we find
...@@ -121,5 +125,5 @@ if(ADIOS2_USE_SysVShMem STREQUAL AUTO) ...@@ -121,5 +125,5 @@ if(ADIOS2_USE_SysVShMem STREQUAL AUTO)
set(ADIOS2_HAVE_SysVShMem OFF) set(ADIOS2_HAVE_SysVShMem OFF)
endif() endif()
elseif(ADIOS2_USE_SysVShMem) elseif(ADIOS2_USE_SysVShMem)
set(ADIOS2_HAVE_SysVShMem) set(ADIOS2_HAVE_SysVShMem TRUE)
endif() endif()
\ No newline at end of file
...@@ -44,9 +44,8 @@ add_library(adios2 ...@@ -44,9 +44,8 @@ add_library(adios2
target_include_directories(adios2 target_include_directories(adios2
PUBLIC PUBLIC
$<BUILD_INTERFACE:${ADIOS2_SOURCE_DIR}/source> $<BUILD_INTERFACE:${ADIOS2_SOURCE_DIR}/source>
$<BUILD_INTERFACE:${ADIOS2_BINARY_DIR}> $<BUILD_INTERFACE:${ADIOS2_BINARY_DIR}/source>
$<INSTALL_INTERFACE:include> $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
PRIVATE ${ADIOS2_SOURCE_DIR}/source
) )
target_link_libraries(adios2 PRIVATE adios2sys pugixml) target_link_libraries(adios2 PRIVATE adios2sys pugixml)
...@@ -139,19 +138,16 @@ set_target_properties(adios2 PROPERTIES ...@@ -139,19 +138,16 @@ set_target_properties(adios2 PROPERTIES
SOVERSION ${ADIOS2_VERSION_MAJOR} SOVERSION ${ADIOS2_VERSION_MAJOR}
) )
install( install(FILES ADIOSMacros.h ADIOSTypes.h ADIOSMPICommOnly.h
FILES ADIOSMacros.h ADIOSTypes.h ADIOSMPICommOnly.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/adios2 DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/adios2
) )
install( install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/core
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/core
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/adios2 DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/adios2
FILES_MATCHING REGEX "[^/]*\.(h|inl)$" FILES_MATCHING REGEX "[^/]*\.(h|inl)$"
) )
# Library installation # Library installation
install( install(TARGETS adios2 EXPORT adios2Exports
TARGETS adios2 EXPORT adios2
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
......
...@@ -10,31 +10,42 @@ if(MSVC) ...@@ -10,31 +10,42 @@ if(MSVC)
message(FATAL_ERROR "DataMan is not currently compatible with MSVC") message(FATAL_ERROR "DataMan is not currently compatible with MSVC")
endif() endif()
set(dataman_targets)
add_library(dataman add_library(dataman
DataManBase.cpp DataManBase.h DataManBase.cpp DataManBase.h
DataMan.cpp DataMan.h DataMan.cpp DataMan.h
CacheMan.cpp CacheMan.h CacheMan.cpp CacheMan.h
) )
target_include_directories(dataman PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) target_include_directories(dataman
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
)
target_link_libraries(dataman target_link_libraries(dataman
PRIVATE adios2sys PRIVATE adios2sys
PUBLIC NLohmannJson PUBLIC NLohmannJson
) )
list(APPEND dataman_targets dataman) set_target_properties(dataman PROPERTIES
VERSION ${ADIOS2_VERSION}
SOVERSION ${ADIOS2_VERSION_MAJOR}
)
install(TARGETS dataman EXPORT adios2Exports
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/dataman
)
# Add the dataman plugins as MODULE libraries instead of SHARED libraries. # Add the dataman plugins as MODULE libraries instead of SHARED libraries.
# MODULE libraries are designed to be plugins, i.e. shared libs that nobody # MODULE libraries are designed to be plugins, i.e. shared libs that nobody
# else links to. # else links to.
set(dataman_modules)
add_library(dumpman MODULE DumpMan.h DumpMan.cpp) add_library(dumpman MODULE DumpMan.h DumpMan.cpp)
target_link_libraries(dumpman PRIVATE dataman) target_link_libraries(dumpman PRIVATE dataman)
list(APPEND dataman_targets dumpman) list(APPEND dataman_modules dumpman)
add_library(temporalman MODULE TemporalMan.h TemporalMan.cpp) add_library(temporalman MODULE TemporalMan.h TemporalMan.cpp)
target_link_libraries(temporalman PRIVATE dataman) target_link_libraries(temporalman PRIVATE dataman)
list(APPEND dataman_targets temporalman) list(APPEND dataman_modules temporalman)
if(ADIOS2_HAVE_ZeroMQ) if(ADIOS2_HAVE_ZeroMQ)
find_package(ZeroMQ REQUIRED) find_package(ZeroMQ REQUIRED)
...@@ -44,14 +55,14 @@ if(ADIOS2_HAVE_ZeroMQ) ...@@ -44,14 +55,14 @@ if(ADIOS2_HAVE_ZeroMQ)
ZmqMan.h ZmqMan.cpp ZmqMan.h ZmqMan.cpp
) )
target_link_libraries(zmqman PRIVATE dataman ZeroMQ::ZMQ) target_link_libraries(zmqman PRIVATE dataman ZeroMQ::ZMQ)
list(APPEND dataman_targets zmqman) list(APPEND dataman_modules zmqman)
add_library(mdtmman MODULE add_library(mdtmman MODULE
StreamMan.h StreamMan.cpp StreamMan.h StreamMan.cpp
MdtmMan.h MdtmMan.cpp MdtmMan.h MdtmMan.cpp
) )
target_link_libraries(mdtmman PRIVATE dataman ZeroMQ::ZMQ) target_link_libraries(mdtmman PRIVATE dataman ZeroMQ::ZMQ)
list(APPEND dataman_targets mdtmman) list(APPEND dataman_modules mdtmman)
endif() endif()
if(ADIOS2_HAVE_ZFP) if(ADIOS2_HAVE_ZFP)
...@@ -60,18 +71,10 @@ if(ADIOS2_HAVE_ZFP) ...@@ -60,18 +71,10 @@ if(ADIOS2_HAVE_ZFP)
add_library(zfpman MODULE ZfpMan.h ZfpMan.cpp) add_library(zfpman MODULE ZfpMan.h ZfpMan.cpp)
target_link_libraries(zfpman PRIVATE dataman zfp::zfp) target_link_libraries(zfpman PRIVATE dataman zfp::zfp)
list(APPEND dataman_targets zfpman) list(APPEND dataman_modules zfpman)
endif() endif()
# Library versioning like this only makes sense for libdataman. The others are plugins install(TARGETS ${dataman_modules}
# loaded via dlopen.
set_target_properties(dataman PROPERTIES
VERSION ${ADIOS2_VERSION}
SOVERSION ${ADIOS2_VERSION_MAJOR}
)
install(
TARGETS ${dataman_targets} EXPORT adios2
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
......
...@@ -4,5 +4,7 @@ set(KWSYS_USE_RegularExpression ON) ...@@ -4,5 +4,7 @@ set(KWSYS_USE_RegularExpression ON)
set(KWSYS_USE_SystemTools ON) set(KWSYS_USE_SystemTools ON)
set(KWSYS_BUILD_SHARED ${ADIOS2_BUILD_SHARED_LIBS}) set(KWSYS_BUILD_SHARED ${ADIOS2_BUILD_SHARED_LIBS})
set(KWSYS_SPLIT_OBJECTS_FROM_INTERFACE ON) set(KWSYS_SPLIT_OBJECTS_FROM_INTERFACE ON)
set(KWSYS_INSTALL_EXPORT_NAME adios2Exports)
set(KWSYS_INSTALL_LIB_DIR ${CMAKE_INSTALL_LIBDIR})
add_subdirectory(adios2sys EXCLUDE_FROM_ALL) add_subdirectory(adios2sys)
...@@ -886,12 +886,16 @@ IF(KWSYS_C_SRCS OR KWSYS_CXX_SRCS) ...@@ -886,12 +886,16 @@ IF(KWSYS_C_SRCS OR KWSYS_CXX_SRCS)
# Set up include usage requirement # Set up include usage requirement
IF(COMMAND TARGET_INCLUDE_DIRECTORIES) IF(COMMAND TARGET_INCLUDE_DIRECTORIES)
TARGET_INCLUDE_DIRECTORIES(${KWSYS_TARGET_INTERFACE} INTERFACE TARGET_INCLUDE_DIRECTORIES(${KWSYS_TARGET_INTERFACE} INTERFACE
${CMAKE_CURRENT_BINARY_DIR}) $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>)
IF(KWSYS_INSTALL_INCLUDE_DIR)
TARGET_INCLUDE_DIRECTORIES(${KWSYS_TARGET_INTERFACE} INTERFACE
$<INSTALL_INTERFACE:${KWSYS_INSTALL_INCLUDE_DIR}>)
ENDIF()
ENDIF() ENDIF()
# Create an install target for the library. # Create an install target for the library.
IF(KWSYS_INSTALL_LIBRARY_RULE) IF(KWSYS_INSTALL_LIBRARY_RULE)
INSTALL(TARGETS ${KWSYS_TARGET_INTERFACE} ${KWSYS_INSTALL_LIBRARY_RULE}) INSTALL(TARGETS ${KWSYS_TARGET_LINK} ${KWSYS_TARGET_INTERFACE} ${KWSYS_INSTALL_LIBRARY_RULE})
ENDIF() ENDIF()
ENDIF() ENDIF()
...@@ -930,6 +934,16 @@ IF(KWSYS_ENABLE_C AND KWSYS_C_SRCS) ...@@ -930,6 +934,16 @@ IF(KWSYS_ENABLE_C AND KWSYS_C_SRCS)
${KWSYS_PROPERTIES_C}) ${KWSYS_PROPERTIES_C})
ENDIF() ENDIF()
# Set up include usage requirement
IF(COMMAND TARGET_INCLUDE_DIRECTORIES)
TARGET_INCLUDE_DIRECTORIES(${KWSYS_TARGET_C_INTERFACE} INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>)
IF(KWSYS_INSTALL_INCLUDE_DIR)
TARGET_INCLUDE_DIRECTORIES(${KWSYS_TARGET_C_INTERFACE} INTERFACE
$<INSTALL_INTERFACE:${KWSYS_INSTALL_INCLUDE_DIR}>)
ENDIF()
ENDIF()
# Create an install target for the library. # Create an install target for the library.
IF(KWSYS_INSTALL_LIBRARY_RULE) IF(KWSYS_INSTALL_LIBRARY_RULE)
INSTALL(TARGETS ${KWSYS_TARGET_C_INTERFACE} ${KWSYS_INSTALL_LIBRARY_RULE}) INSTALL(TARGETS ${KWSYS_TARGET_C_INTERFACE} ${KWSYS_INSTALL_LIBRARY_RULE})
......
add_library(NLohmannJson INTERFACE) add_subdirectory(json)
target_include_directories(NLohmannJson
INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/json/src
)
add_library(NLohmannJson INTERFACE)
target_include_directories(NLohmannJson INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
)
install(TARGETS NLohmannJson EXPORT adios2Exports)
# This is an extremely simple and tiny library. Rather than build it add_subdirectory(pugixml)
# seperately we'll just create an interface library containing the sources and
# headers
add_library(pugixml INTERFACE)
target_sources(pugixml INTERFACE
${CMAKE_CURRENT_SOURCE_DIR}/pugixml/src/pugiconfig.hpp
${CMAKE_CURRENT_SOURCE_DIR}/pugixml/src/pugixml.hpp
${CMAKE_CURRENT_SOURCE_DIR}/pugixml/src/pugixml.cpp
)
target_include_directories(pugixml INTERFACE
${CMAKE_CURRENT_SOURCE_DIR}/pugixml/src
)
add_library(pugixml INTERFACE)
target_sources(pugixml INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/pugiconfig.hpp>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/pugixml.hpp>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/pugixml.cpp>
)
target_include_directories(pugixml INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
)
install(TARGETS pugixml EXPORT adios2Exports)
Supports Markdown
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