1
0
mirror of https://github.com/microsoft/DirectXTex synced 2024-11-24 21:30:14 +00:00

Updated CMake to use GNUInstallDirs

This commit is contained in:
Chuck Walbourn 2022-05-02 03:01:40 -07:00
parent 98c5b56edf
commit 0f204f9a2f

View File

@ -52,6 +52,8 @@ elseif(CMAKE_GENERATOR_PLATFORM MATCHES "^[Aa][Rr][Mm]64$")
set(DIRECTX_ARCH arm64)
endif()
include(GNUInstallDirs)
#--- Library
set(LIBRARY_HEADERS
DirectXTex/DirectXTex.h
@ -147,7 +149,7 @@ source_group(${PROJECT_NAME} REGULAR_EXPRESSION DirectXTex/*.*)
target_include_directories(${PROJECT_NAME} PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/DirectXTex>
$<INSTALL_INTERFACE:include>)
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
if(ENABLE_OPENEXR_SUPPORT)
find_package(OpenEXR REQUIRED)
@ -184,32 +186,32 @@ include(CMakePackageConfigHelpers)
string(TOLOWER ${PROJECT_NAME} PACKAGE_NAME)
write_basic_package_version_file(
${PROJECT_BINARY_DIR}/cmake/${PACKAGE_NAME}-config-version.cmake
${PACKAGE_NAME}-config-version.cmake
VERSION ${DIRECTXTEX_VERSION}
COMPATIBILITY AnyNewerVersion)
install(TARGETS ${PROJECT_NAME}
EXPORT ${PROJECT_NAME}-targets
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin)
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/.nuget/${PROJECT_NAME}-config.cmake.in
${PROJECT_BINARY_DIR}/cmake/${PACKAGE_NAME}-config.cmake
INSTALL_DESTINATION cmake/})
${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE_NAME}-config.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PACKAGE_NAME}/cmake/)
install(EXPORT ${PROJECT_NAME}-targets
FILE ${PROJECT_NAME}-targets.cmake
NAMESPACE Microsoft::
DESTINATION cmake/)
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PACKAGE_NAME}/cmake/)
install(FILES ${LIBRARY_HEADERS}
DESTINATION include)
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(FILES
${PROJECT_BINARY_DIR}/cmake/${PACKAGE_NAME}-config.cmake
${PROJECT_BINARY_DIR}/cmake/${PACKAGE_NAME}-config-version.cmake
DESTINATION cmake/)
${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE_NAME}-config.cmake
${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE_NAME}-config-version.cmake
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PACKAGE_NAME}/cmake/)
#--- Command-line tools
if(BUILD_TOOLS AND WIN32 AND (NOT WINDOWS_STORE))