switch to cmake module GNUInstallDirs #116

See:

https://cmake.org/cmake/help/v2.8.12/cmake.html#module:GNUInstallDirs

Use these variables to set all installation paths.

Add link and note about module to README.md .
This commit is contained in:
Rafael Kitover 2017-05-24 04:25:45 -07:00
parent 535a2d5a32
commit 783475bf39
3 changed files with 16 additions and 35 deletions

View File

@ -207,31 +207,11 @@ ELSE( ENABLE_LIRC )
SET( WITHLIRC 0 )
ENDIF( ENABLE_LIRC )
# Set the default binary dir
IF( NOT BIN_INSTALL_DIR )
SET( BIN_INSTALL_DIR "bin" )
ENDIF( NOT BIN_INSTALL_DIR )
# Set the default install dir
IF( NOT DATA_INSTALL_DIR )
SET( DATA_INSTALL_DIR "share/vbam" )
ENDIF( NOT DATA_INSTALL_DIR )
SET( PKGDATADIR ${CMAKE_INSTALL_PREFIX}/${DATA_INSTALL_DIR} )
#Set the default manual dir
IF( NOT MAN_INSTALL_DIR )
SET( MAN_INSTALL_DIR "share/man" )
ENDIF( NOT MAN_INSTALL_DIR )
# Set the configuration file location
IF( NOT SYSCONF_INSTALL_DIR )
SET( SYSCONF_INSTALL_DIR "/etc" )
ENDIF( NOT SYSCONF_INSTALL_DIR )
INCLUDE(GNUInstallDirs)
# C defines
ADD_DEFINITIONS (-DHAVE_NETINET_IN_H -DHAVE_ARPA_INET_H -DHAVE_ZLIB_H -DFINAL_VERSION -DSDL -DUSE_OPENGL -DSYSCONF_INSTALL_DIR=\\\""${SYSCONF_INSTALL_DIR}"\\\" -DWITH_LIRC=${WITHLIRC})
ADD_DEFINITIONS (-DVERSION=\\\""${VERSION}"\\\" -DPKGDATADIR=\\\""${PKGDATADIR}"\\\" -DPACKAGE=)
ADD_DEFINITIONS (-DHAVE_NETINET_IN_H -DHAVE_ARPA_INET_H -DHAVE_ZLIB_H -DFINAL_VERSION -DSDL -DUSE_OPENGL -DSYSCONF_INSTALL_DIR=\\\""${CMAKE_INSTALL_FULL_SYSCONFDIR}"\\\" -DWITH_LIRC=${WITHLIRC})
ADD_DEFINITIONS (-DVERSION=\\\""${VERSION}"\\\" -DPKGDATADIR=\\\""${CMAKE_INSTALL_FULL_DATADIR}/vbam"\\\" -DPACKAGE=)
if( ENABLE_LINK )
# IPC linking code needs sem_timedwait which can be either in librt or pthreads
@ -728,22 +708,22 @@ IF( ENABLE_SDL )
${WIN32_LIBRARIES}
${LIRC_CLIENT_LIBRARY}
)
INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/vbam DESTINATION ${BIN_INSTALL_DIR})
INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/vbam DESTINATION ${CMAKE_INSTALL_FULL_BINDIR})
IF( WIN32 )
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/sdl/vbam.cfg-example
DESTINATION ${CMAKE_INSTALL_PREFIX}/${SYSCONF_INSTALL_DIR}
DESTINATION ${CMAKE_INSTALL_FULL_SYSCONFDIR}
RENAME vbam.cfg)
ELSE( WIN32 )
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/sdl/vbam.cfg-example
DESTINATION ${SYSCONF_INSTALL_DIR}
DESTINATION ${CMAKE_INSTALL_FULL_SYSCONFDIR}
RENAME vbam.cfg)
ENDIF( WIN32 )
ENDIF( ENABLE_SDL )
IF( ENABLE_WX )
add_subdirectory(src/wx)
INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/visualboyadvance-m${CMAKE_EXECUTABLE_SUFFIX} DESTINATION ${BIN_INSTALL_DIR})
INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/visualboyadvance-m${CMAKE_EXECUTABLE_SUFFIX} DESTINATION ${CMAKE_INSTALL_FULL_BINDIR})
ENDIF( ENABLE_WX )
if( ENABLE_WX )
@ -752,15 +732,15 @@ if( ENABLE_WX )
add_subdirectory(po)
endif( ENABLE_NLS )
endif( ENABLE_WX )
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/vba-over.ini DESTINATION ${DATA_INSTALL_DIR})
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/vba-over.ini DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/vbam)
# manual pages
IF( UNIX )
IF( ENABLE_SDL )
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/debian/vbam.6 DESTINATION ${MAN_INSTALL_DIR}/man6)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/debian/vbam.6 DESTINATION ${CMAKE_INSTALL_FULL_MANDIR}/man6)
ENDIF( ENABLE_SDL )
IF( ENABLE_WX )
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/debian/visualboyadvance-m.6 DESTINATION ${MAN_INSTALL_DIR}/man6)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/debian/visualboyadvance-m.6 DESTINATION ${CMAKE_INSTALL_FULL_MANDIR}/man6)
ENDIF( ENABLE_WX )
ENDIF( UNIX )
@ -769,7 +749,7 @@ IF( NOT WIN32 AND NOT APPLE )
IF( ENABLE_WX )
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/wx/wxvbam.desktop DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/wx/wxvbam.appdata.xml DESTINATION ${CMAKE_INSTALL_PREFIX}/share/appdata)
INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/wx/icons/sizes/ DESTINATION share/icons/hicolor)
INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/wx/icons/sizes/ DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor)
ENDIF( ENABLE_WX )
ENDIF( NOT WIN32 AND NOT APPLE )

View File

@ -122,9 +122,10 @@ Here is the complete list:
| ENABLE_DIRECT3D | Direct3D rendering for wxWidgets (Windows, **NOT IMPLEMENTED!!!**) | ON |
| ENABLE_XAUDIO2 | Enable xaudio2 sound output for wxWidgets (Windows only) | ON |
| ENABLE_OPENAL | Enable OpenAL for the wxWidgets port | ON |
| BIN_INSTALL_DIR | Configure the default binary directory | bin |
| DATA_INSTALL_DIR | Configure the default data directory | share/vbam |
| MAN_INSTALL_DIR | Configure the default manual directory | share/man |
Note for distro packagers, we use the CMake module
[GNUInstallDirs](https://cmake.org/cmake/help/v2.8.12/cmake.html#module:GNUInstallDirs)
to configure installation directories.
## MSys2 Notes

View File

@ -421,7 +421,7 @@ IF(WIN32)
INSTALL(PROGRAMS ${PROJECT_BINARY_DIR}/visualboyadvance-m${CMAKE_EXECUTABLE_SUFFIX} DESTINATION ${CMAKE_BINARY_DIR})
ENDIF(WIN32)
IF(NOT WIN32 AND NOT APPLE)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/wxvbam.desktop DESTINATION share/applications)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/wxvbam.desktop DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications)
ENDIF(NOT WIN32 AND NOT APPLE)
if(APPLE)