This fixes installation in multi-arch paths on systems which supports that.
cmake_minimum_required(VERSION 2.6)
project(libam7xxx C)
+include (GNUInstallDirs)
+
set(PROJECT_DESCRIPTION
"Communication library for Actions Micro AM7XXX based USB projectors and DPFs")
install(CODE "execute_process(COMMAND ${CMAKE_BUILD_TOOL} doc)")
install(DIRECTORY ${DOC_OUTPUT_PATH}/html
- DESTINATION "${CMAKE_INSTALL_PREFIX}/share/doc/${CMAKE_PROJECT_NAME}"
+ DESTINATION ${CMAKE_INSTALL_DOCDIR}
COMPONENT doc)
endif(DOXYGEN_FOUND)
${DOC_OUTPUT_PATH}/man/am7xxx-play.1
${DOC_OUTPUT_PATH}/man/am7xxx-modeswitch.1
${DOC_OUTPUT_PATH}/man/picoproj.1
- DESTINATION "${CMAKE_INSTALL_PREFIX}/share/man/man1/"
+ DESTINATION "${CMAKE_INSTALL_MANDIR}/man1/"
COMPONENT manpages)
endif(ASCIIDOC_FOUND)
add_executable(picoproj picoproj.c)
target_link_libraries(picoproj am7xxx)
install(TARGETS picoproj
- DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")
+ DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()
# Build a more complete example
${FFMPEG_LIBSWSCALE_LIBRARIES}
${OPTIONAL_LIBRARIES})
install(TARGETS am7xxx-play
- DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")
+ DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()
# Build a simple usb-modeswitch clone for am7xxx devices
add_executable(am7xxx-modeswitch am7xxx-modeswitch.c)
target_link_libraries(am7xxx-modeswitch ${LIBUSB_1_LIBRARIES})
install(TARGETS am7xxx-modeswitch
- DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")
+ DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()
VERSION ${PROJECT_VER}
SOVERSION ${PROJECT_APIVER})
install(TARGETS am7xxx
- DESTINATION "${CMAKE_INSTALL_PREFIX}/lib")
+ DESTINATION "${CMAKE_INSTALL_LIBDIR}")
add_library(am7xxx-static STATIC ${SRC})
set_target_properties(am7xxx-static PROPERTIES OUTPUT_NAME am7xxx)
set_target_properties(am7xxx-static PROPERTIES COMPILE_FLAGS "-fPIC")
endif()
install(TARGETS am7xxx-static
- DESTINATION "${CMAKE_INSTALL_PREFIX}/lib")
+ DESTINATION "${CMAKE_INSTALL_LIBDIR}")
if(NOT WIN32)
find_library(MATH_LIB m)
# Install the header files
install(FILES "am7xxx.h"
- DESTINATION "${CMAKE_INSTALL_PREFIX}/include")
+ DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
if(UNIX AND NOT APPLE)
# Produce a pkg-config file for linking against the shared lib
configure_file("libam7xxx.pc.in" "libam7xxx.pc" @ONLY)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libam7xxx.pc"
- DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/pkgconfig")
+ DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
endif()
-prefix=@CMAKE_INSTALL_PREFIX@
-exec_prefix=${prefix}
-libdir=${exec_prefix}/lib
-includedir=${prefix}/include
+libdir=@CMAKE_INSTALL_FULL_LIBDIR@
+includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
Name: @PROJECT_NAME@
Description: @PROJECT_DESCRIPTION@