| 1 |
# SPDX-License-Identifier: BSD-3-Clause |
| 2 |
# Copyright Contributors to the OpenEXR Project. |
| 3 |
|
| 4 |
### The autoconf setup for this folder generates a PyImathConfig.h file |
| 5 |
### but no source actually uses that, so let's elide that for now |
| 6 |
|
| 7 |
add_library(PyImathConfig INTERFACE) |
| 8 |
target_include_directories(PyImathConfig INTERFACE |
| 9 |
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>) |
| 10 |
install(TARGETS PyImathConfig EXPORT ${PROJECT_NAME}) |
| 11 |
add_library(PyImath::Config ALIAS PyImathConfig) |
| 12 |
|
| 13 |
if(IMATH_INSTALL_PKG_CONFIG) |
| 14 |
# use a helper function to avoid variable pollution, but pretty simple |
| 15 |
function(pyimath_pkg_config_help pcinfile) |
| 16 |
set(prefix ${CMAKE_INSTALL_PREFIX}) |
| 17 |
set(exec_prefix "\${prefix}") |
| 18 |
set(libdir "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}") |
| 19 |
set(includedir "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}") |
| 20 |
string(TOUPPER "${CMAKE_BUILD_TYPE}" uppercase_CMAKE_BUILD_TYPE) |
| 21 |
set(LIB_SUFFIX_DASH ${IMATH_LIB_SUFFIX}${CMAKE_${uppercase_CMAKE_BUILD_TYPE}_POSTFIX}) |
| 22 |
string(REPLACE ".in" "" pcout ${pcinfile}) |
| 23 |
configure_file(${pcinfile} ${CMAKE_CURRENT_BINARY_DIR}/${pcout} @ONLY) |
| 24 |
install( |
| 25 |
FILES ${CMAKE_CURRENT_BINARY_DIR}/${pcout} |
| 26 |
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig |
| 27 |
) |
| 28 |
endfunction() |
| 29 |
pyimath_pkg_config_help(../PyImath.pc.in) |
| 30 |
else() |
| 31 |
message(STATUS "pkg-config generation disabled") |
| 32 |
endif() |