CMake: Use GNUInstallDirs module to set proper defaults for install directories

This commit is contained in:
Rolf Eike Beer 2017-12-14 09:57:54 +01:00 committed by Sebastian Pipping
parent 1a53fcb1dd
commit 5681911965
2 changed files with 12 additions and 8 deletions

View File

@ -3,13 +3,15 @@
project(expat) project(expat)
cmake_minimum_required(VERSION 2.6) cmake_minimum_required(VERSION 2.8.10)
set(PACKAGE_BUGREPORT "expat-bugs@libexpat.org") set(PACKAGE_BUGREPORT "expat-bugs@libexpat.org")
set(PACKAGE_NAME "expat") set(PACKAGE_NAME "expat")
set(PACKAGE_VERSION "2.2.5") set(PACKAGE_VERSION "2.2.5")
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
set(PACKAGE_TARNAME "${PACKAGE_NAME}") set(PACKAGE_TARNAME "${PACKAGE_NAME}")
include(GNUInstallDirs)
if(WINCE) if(WINCE)
set(BUILD_tools_default OFF) set(BUILD_tools_default OFF)
else() else()
@ -137,9 +139,9 @@ macro(expat_install)
endif() endif()
endmacro() endmacro()
expat_install(TARGETS expat RUNTIME DESTINATION bin expat_install(TARGETS expat RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION lib LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION lib) ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
set(prefix ${CMAKE_INSTALL_PREFIX}) set(prefix ${CMAKE_INSTALL_PREFIX})
set(exec_prefix "\${prefix}") set(exec_prefix "\${prefix}")
@ -147,8 +149,8 @@ set(libdir "\${exec_prefix}/lib")
set(includedir "\${prefix}/include") set(includedir "\${prefix}/include")
configure_file(expat.pc.in ${CMAKE_CURRENT_BINARY_DIR}/expat.pc @ONLY) configure_file(expat.pc.in ${CMAKE_CURRENT_BINARY_DIR}/expat.pc @ONLY)
expat_install(FILES lib/expat.h lib/expat_external.h DESTINATION include) expat_install(FILES lib/expat.h lib/expat_external.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
expat_install(FILES ${CMAKE_CURRENT_BINARY_DIR}/expat.pc DESTINATION lib/pkgconfig) expat_install(FILES ${CMAKE_CURRENT_BINARY_DIR}/expat.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
if(BUILD_tools) if(BUILD_tools)
set(xmlwf_SRCS set(xmlwf_SRCS
@ -161,10 +163,10 @@ if(BUILD_tools)
add_executable(xmlwf ${xmlwf_SRCS}) add_executable(xmlwf ${xmlwf_SRCS})
set_property(TARGET xmlwf PROPERTY RUNTIME_OUTPUT_DIRECTORY xmlwf) set_property(TARGET xmlwf PROPERTY RUNTIME_OUTPUT_DIRECTORY xmlwf)
target_link_libraries(xmlwf expat) target_link_libraries(xmlwf expat)
expat_install(TARGETS xmlwf DESTINATION bin) expat_install(TARGETS xmlwf DESTINATION ${CMAKE_INSTALL_BINDIR})
if(BUILD_doc) if(BUILD_doc)
add_custom_command(TARGET expat PRE_BUILD COMMAND "${DOCBOOK_TO_MAN}" "${PROJECT_SOURCE_DIR}/doc/xmlwf.xml" && mv "XMLWF.1" "${PROJECT_SOURCE_DIR}/doc/xmlwf.1") add_custom_command(TARGET expat PRE_BUILD COMMAND "${DOCBOOK_TO_MAN}" "${PROJECT_SOURCE_DIR}/doc/xmlwf.xml" && mv "XMLWF.1" "${PROJECT_SOURCE_DIR}/doc/xmlwf.1")
expat_install(FILES "${PROJECT_SOURCE_DIR}/doc/xmlwf.1" DESTINATION share/man/man1) expat_install(FILES "${PROJECT_SOURCE_DIR}/doc/xmlwf.1" DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
endif() endif()
endif() endif()

View File

@ -14,6 +14,8 @@ Release 2.2.? ???????????????????
#174 CMake: Introduce option WARNINGS_AS_ERRORS, defaults to OFF #174 CMake: Introduce option WARNINGS_AS_ERRORS, defaults to OFF
#175 CMake: Prefer check_symbol_exists over check_function_exists #175 CMake: Prefer check_symbol_exists over check_function_exists
#176 CMake: Create the same pkg-config file as with GNU Autotools #176 CMake: Create the same pkg-config file as with GNU Autotools
#178 #179 CMake: Use GNUInstallDirs module to set proper defaults for
install directories
#131 #173 Address compiler warnings #131 #173 Address compiler warnings
Special thanks to: Special thanks to: