Browse Source

Add install() for CMake.

asheep
Alibek Omarov 7 years ago
parent
commit
c128c69ceb
  1. 4
      CMakeLists.txt
  2. 13
      cl_dll/CMakeLists.txt
  3. 13
      dlls/CMakeLists.txt

4
CMakeLists.txt

@ -32,6 +32,10 @@ option(USE_VOICEMGR "Enable VOICE MANAGER." OFF)
option(BUILD_CLIENT "Build client dll" ON) option(BUILD_CLIENT "Build client dll" ON)
option(BUILD_SERVER "Build server dll" ON) option(BUILD_SERVER "Build server dll" ON)
option(GOLDSOURCE_SUPPORT "Build goldsource compatible client library" OFF) option(GOLDSOURCE_SUPPORT "Build goldsource compatible client library" OFF)
set(GAMEDIR "valve" CACHE STRING "Gamedir path")
set(SERVER_INSTALL_DIR "dlls" CACHE STRING "Where put server dll")
set(CLIENT_INSTALL_DIR "cl_dlls" CACHE STRING "Where put client dll")
set(SERVER_LIBRARY_NAME "hl" CACHE STRING "Library name for Linux/MacOS/Windows")
#----------------- #-----------------
# MAIN BUILD CODE \ # MAIN BUILD CODE \

13
cl_dll/CMakeLists.txt

@ -110,6 +110,17 @@ if (GOLDSOURCE_SUPPORT)
target_link_libraries( ${CLDLL_LIBRARY} ${CMAKE_DL_LIBS} ) target_link_libraries( ${CLDLL_LIBRARY} ${CMAKE_DL_LIBS} )
endif() endif()
set_target_properties (${CLDLL_SHARED} PROPERTIES set_target_properties (${CLDLL_LIBRARY} PROPERTIES
POSITION_INDEPENDENT_CODE 1) POSITION_INDEPENDENT_CODE 1)
if(APPLE OR WIN32 OR ${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
set_target_properties(${CLDLL_LIBRARY} PROPERTIES
OUTPUT_NAME "client"
PREFIX "")
endif()
install( TARGETS ${CLDLL_LIBRARY}
DESTINATION "${GAMEDIR}/${CLIENT_INSTALL_DIR}/"
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE )

13
dlls/CMakeLists.txt

@ -145,6 +145,17 @@ endif()
add_library (${SVDLL_LIBRARY} SHARED ${SVDLL_SOURCES}) add_library (${SVDLL_LIBRARY} SHARED ${SVDLL_SOURCES})
set_target_properties (${SVDLL_SHARED} PROPERTIES set_target_properties (${SVDLL_LIBRARY} PROPERTIES
POSITION_INDEPENDENT_CODE 1) POSITION_INDEPENDENT_CODE 1)
if(APPLE OR WIN32 OR ${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
set_target_properties(${SVDLL_LIBRARY} PROPERTIES
OUTPUT_NAME ${SERVER_LIBRARY_NAME}
PREFIX "")
endif()
install( TARGETS ${SVDLL_LIBRARY}
DESTINATION "${GAMEDIR}/${SERVER_INSTALL_DIR}/"
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE)

Loading…
Cancel
Save