| 1 |
cmake_minimum_required (VERSION 3.1.0) |
| 2 |
project (H5BZ2_SRC C) |
| 3 |
|
| 4 |
#----------------------------------------------------------------------------- |
| 5 |
# Setup include Directories |
| 6 |
#----------------------------------------------------------------------------- |
| 7 |
INCLUDE_DIRECTORIES (${H5BZ2_SRC_SOURCE_DIR}) |
| 8 |
INCLUDE_DIRECTORIES (${CMAKE_BINARY_DIR}) |
| 9 |
|
| 10 |
#----------------------------------------------------------------------------- |
| 11 |
# Apply Definitions to compiler in this directory and below |
| 12 |
#----------------------------------------------------------------------------- |
| 13 |
add_definitions (${HDF5_EXTRA_C_FLAGS}) |
| 14 |
|
| 15 |
#----------------------------------------------------------------------------- |
| 16 |
# Setup include Directories |
| 17 |
#----------------------------------------------------------------------------- |
| 18 |
INCLUDE_DIRECTORIES (${HDF5_INCLUDE_DIR} ${BZ2_INCLUDE_DIRS}) |
| 19 |
|
| 20 |
#----------------------------------------------------------------------------- |
| 21 |
# Define H5BZ2 Library |
| 22 |
#----------------------------------------------------------------------------- |
| 23 |
set (H5BZ2_SRCS |
| 24 |
${H5BZ2_SRC_SOURCE_DIR}/H5Zbzip2.c |
| 25 |
) |
| 26 |
|
| 27 |
add_library (${H5BZ2_LIB_TARGET} ${LIB_TYPE} ${H5BZ2_SRCS}) |
| 28 |
target_link_libraries (${H5BZ2_LIB_TARGET} ${LINK_LIBS}) |
| 29 |
SET_GLOBAL_VARIABLE (H5BZ2_LIBRARIES_TO_EXPORT ${H5BZ2_LIB_TARGET}) |
| 30 |
H5BZ2_SET_LIB_OPTIONS (${H5BZ2_LIB_TARGET} ${H5BZ2_LIB_NAME} ${LIB_TYPE}) |
| 31 |
|
| 32 |
if (BUILD_TESTING) |
| 33 |
#----------------------------------------------------------------------------- |
| 34 |
# Copy plugin library to a plugins folder |
| 35 |
#----------------------------------------------------------------------------- |
| 36 |
|
| 37 |
# make plugins dir |
| 38 |
file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/plugins") |
| 39 |
add_custom_command ( |
| 40 |
TARGET ${H5BZ2_LIB_TARGET} |
| 41 |
POST_BUILD |
| 42 |
COMMAND ${CMAKE_COMMAND} |
| 43 |
ARGS -E copy_if_different |
| 44 |
"$<TARGET_FILE:${H5BZ2_LIB_TARGET}>" |
| 45 |
"${CMAKE_BINARY_DIR}/plugins/$<TARGET_FILE_NAME:${H5BZ2_LIB_TARGET}>" |
| 46 |
) |
| 47 |
endif (BUILD_TESTING) |
| 48 |
|
| 49 |
#----------------------------------------------------------------------------- |
| 50 |
# Add Target(s) to CMake Install for import into other projects |
| 51 |
#----------------------------------------------------------------------------- |
| 52 |
if (H5BZ2_EXPORTED_TARGETS) |
| 53 |
install ( |
| 54 |
TARGETS |
| 55 |
${H5BZ2_LIB_TARGET} |
| 56 |
EXPORT |
| 57 |
${H5BZ2_EXPORTED_TARGETS} |
| 58 |
LIBRARY DESTINATION ${H5BZ2_INSTALL_LIB_DIR} COMPONENT libraries |
| 59 |
ARCHIVE DESTINATION ${H5BZ2_INSTALL_LIB_DIR} COMPONENT libraries |
| 60 |
RUNTIME DESTINATION ${H5BZ2_INSTALL_BIN_DIR} COMPONENT libraries |
| 61 |
) |
| 62 |
endif (H5BZ2_EXPORTED_TARGETS) |
| 63 |
|