1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-11-22 02:12:45 +01:00

cmake: use GNUInstallDirs for install paths + install everything (optionally)

This commit is contained in:
Anonymous Maarten 2018-06-01 17:46:13 +02:00
parent 10b18dada2
commit e3c0b00453
7 changed files with 28 additions and 9 deletions

View File

@ -2,6 +2,8 @@ cmake_minimum_required(VERSION 3.2.2)
project(OpenRW) project(OpenRW)
include(GNUInstallDirs)
# Read the configuration arguments # Read the configuration arguments
include("${PROJECT_SOURCE_DIR}/cmake_options.cmake") include("${PROJECT_SOURCE_DIR}/cmake_options.cmake")
@ -38,11 +40,9 @@ if(BUILD_TESTS)
endif() endif()
# Copy the license to the install directory # Copy the license to the install directory
if(CMAKE_SYSTEM_NAME MATCHES "Linux|FreeBSD")
install(FILES COPYING install(FILES COPYING
DESTINATION "${DOC_DIR}" DESTINATION "${CMAKE_INSTALL_DOCDIR}"
) )
endif()
# Copy the license to the build directory (for CI) # Copy the license to the build directory (for CI)
file(COPY COPYING file(COPY COPYING

View File

@ -14,8 +14,7 @@ set_property(CACHE FAILED_CHECK_ACTION PROPERTY STRINGS "IGNORE" "ABORT" "BREAKP
set(FILESYSTEM_LIBRARY "BOOST" CACHE STRING "Which filesystem library to use") set(FILESYSTEM_LIBRARY "BOOST" CACHE STRING "Which filesystem library to use")
set_property(CACHE FILESYSTEM_LIBRARY PROPERTY STRINGS "CXX17" "CXXTS" "BOOST") set_property(CACHE FILESYSTEM_LIBRARY PROPERTY STRINGS "CXX17" "CXXTS" "BOOST")
set(BIN_DIR "bin" CACHE STRING "Prefix subdirectory to put the binaries in.") option(INSTALL_LIBS "Install rwengine libraries")
set(DOC_DIR "share/doc/openrw" CACHE STRING "Prefix subdirectory to put the documentation in.")
if(NOT CMAKE_BUILD_TYPE) if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build, options are: Debug Release") set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build, options are: Debug Release")

View File

@ -159,3 +159,10 @@ target_include_directories(rwengine
) )
openrw_target_apply_options(TARGET rwengine) openrw_target_apply_options(TARGET rwengine)
if(INSTALL_LIBS)
install(TARGETS rwengine
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
)
endif()

View File

@ -65,4 +65,6 @@ target_link_libraries(rwgame
openrw_target_apply_options(TARGET rwgame) openrw_target_apply_options(TARGET rwgame)
install(TARGETS rwgame RUNTIME DESTINATION "${BIN_DIR}") install(TARGETS rwgame
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
)

View File

@ -64,3 +64,10 @@ target_link_libraries(rwlib
) )
openrw_target_apply_options(TARGET rwlib) openrw_target_apply_options(TARGET rwlib)
if(INSTALL_LIBS)
install(TARGETS rwlib
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
)
endif()

View File

@ -35,5 +35,5 @@ target_link_libraries(rwviewer
openrw_target_apply_options(TARGET rwviewer) openrw_target_apply_options(TARGET rwviewer)
install(TARGETS rwviewer install(TARGETS rwviewer
RUNTIME DESTINATION "${BIN_DIR}" RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
) )

View File

@ -114,3 +114,7 @@ else()
TIMEOUT 300 TIMEOUT 300
) )
endif() endif()
install(TARGETS rwtests
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
)