From c128c69ceb2a96730ffe487bef234c4e59f3cac3 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Tue, 19 Dec 2017 00:27:56 +0300 Subject: [PATCH] Add install() for CMake. --- CMakeLists.txt | 4 ++++ cl_dll/CMakeLists.txt | 13 ++++++++++++- dlls/CMakeLists.txt | 13 ++++++++++++- 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7719bac6..0d754eb5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,6 +32,10 @@ option(USE_VOICEMGR "Enable VOICE MANAGER." OFF) option(BUILD_CLIENT "Build client dll" ON) option(BUILD_SERVER "Build server dll" ON) 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 \ diff --git a/cl_dll/CMakeLists.txt b/cl_dll/CMakeLists.txt index aa1e94f8..2d247950 100644 --- a/cl_dll/CMakeLists.txt +++ b/cl_dll/CMakeLists.txt @@ -110,6 +110,17 @@ if (GOLDSOURCE_SUPPORT) target_link_libraries( ${CLDLL_LIBRARY} ${CMAKE_DL_LIBS} ) endif() -set_target_properties (${CLDLL_SHARED} PROPERTIES +set_target_properties (${CLDLL_LIBRARY} PROPERTIES 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 ) diff --git a/dlls/CMakeLists.txt b/dlls/CMakeLists.txt index 4e56ab44..480b61d1 100644 --- a/dlls/CMakeLists.txt +++ b/dlls/CMakeLists.txt @@ -145,6 +145,17 @@ endif() add_library (${SVDLL_LIBRARY} SHARED ${SVDLL_SOURCES}) -set_target_properties (${SVDLL_SHARED} PROPERTIES +set_target_properties (${SVDLL_LIBRARY} PROPERTIES 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)