Files
tenacity/help/CMakeLists.txt
Avery King a86036c072 CMake: Fix install rules
Fix install rules for packaging on Windows with Ninja.

Signed-off-by: Avery King <gperson@disroot.org>
2025-03-25 14:47:14 +00:00

49 lines
1.7 KiB
CMake
Executable File

set( TARGET manual )
set( TARGET_ROOT ${CMAKE_SOURCE_DIR}/manual )
message( STATUS "========== Configuring ${TARGET} ==========" )
def_vars()
if (NOT WIN32 AND NOT APPLE)
configure_file( ${APP_NAME}.metainfo.xml.in ${_INTDIR}/${APP_NAME}.metainfo.xml )
endif()
add_custom_target( ${TARGET} DEPENDS "${MANUAL_PATH}" )
if (PACKAGE_MANUAL)
# Error if the manual path is not empty and doesn't exist.
if (NOT EXISTS "${MANUAL_PATH}")
message(
FATAL_ERROR
"You have specified a manual path that doesn't exist. Check the path (${MANUAL_PATH}) and try again."
)
endif()
install(CODE " \
execute_process( \
COMMAND \
${CMAKE_COMMAND} \
--build ${CMAKE_BINARY_DIR} \
--config \${CMAKE_INSTALL_CONFIG_NAME} \
--target manual \
) \
")
if( CMAKE_SYSTEM_NAME MATCHES "Darwin" )
install( DIRECTORY "${MANUAL_PATH}/" DESTINATION "${_APPDIR}/help/manual" )
elseif( CMAKE_SYSTEM_NAME MATCHES "Windows" )
install( DIRECTORY "${MANUAL_PATH}/" DESTINATION "help/manual" )
endif()
endif()
if( NOT CMAKE_SYSTEM_NAME MATCHES "Darwin" AND NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
install( DIRECTORY "${MANUAL_PATH}" OPTIONAL
DESTINATION "${_DATADIR}/tenacity/help" )
install( FILES "${_SRCDIR}/tenacity.1"
DESTINATION "${_MANDIR}/man1" )
install( FILES "${_INTDIR}/${APP_NAME}.metainfo.xml"
DESTINATION "${_DATADIR}/metainfo" )
endif()