aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoripriver <g1ran1q@gmail.com>2020-06-17 14:42:49 +0000
committerShauren <shauren.trinity@gmail.com>2022-01-06 22:54:29 +0100
commit8979493bb7eacc557a0fd51cb781f134b97b3b29 (patch)
tree9eef26c447dda93f05339eb82c56506e613284b2
parentbcd00244c312db02b0feaf950de1436c4427993e (diff)
Additional cmake entry for configs
Closes #24812 Co-authored-by: Carbenium <carbenium@outlook.com> (cherry picked from commit dc467ee0f6d0a49be4bd20b621f141228dfec736)
-rw-r--r--cmake/options.cmake1
-rw-r--r--cmake/showoptions.cmake9
-rw-r--r--src/server/bnetserver/CMakeLists.txt24
-rw-r--r--src/server/worldserver/CMakeLists.txt10
4 files changed, 37 insertions, 7 deletions
diff --git a/cmake/options.cmake b/cmake/options.cmake
index 44cb2531adb..ec1d851cd40 100644
--- a/cmake/options.cmake
+++ b/cmake/options.cmake
@@ -49,6 +49,7 @@ endif()
option(WITH_WARNINGS "Show all warnings during compile" 0)
option(WITH_COREDEBUG "Include additional debug-code in core" 0)
option(WITH_STRICT_DATABASE_TYPE_CHECKS "Enable strict checking of database field value accessors" 0)
+option(COPY_CONF "Copy authserver and worldserver .conf.dist files to the project dir" 1)
set(WITH_SOURCE_TREE "hierarchical" CACHE STRING "Build the source tree for IDE's.")
set_property(CACHE WITH_SOURCE_TREE PROPERTY STRINGS no flat hierarchical hierarchical-folders)
option(WITHOUT_GIT "Disable the GIT testing routines" 0)
diff --git a/cmake/showoptions.cmake b/cmake/showoptions.cmake
index cbeb3a9e5d8..5df73bd142a 100644
--- a/cmake/showoptions.cmake
+++ b/cmake/showoptions.cmake
@@ -12,6 +12,15 @@ message("* Install core to : ${CMAKE_INSTALL_PREFIX}")
if( UNIX )
message("* Install configs to : ${CONF_DIR}")
endif()
+
+if( COPY_CONF )
+ if( UNIX )
+ message("* Install configs to : ${CONF_DIR}")
+ else()
+ message("* Install configs to : ${CMAKE_INSTALL_PREFIX}")
+ endif()
+endif()
+
message("")
# Show infomation about the options selected during configuration
diff --git a/src/server/bnetserver/CMakeLists.txt b/src/server/bnetserver/CMakeLists.txt
index 0b66a8ac181..ba57011595d 100644
--- a/src/server/bnetserver/CMakeLists.txt
+++ b/src/server/bnetserver/CMakeLists.txt
@@ -62,18 +62,30 @@ set_target_properties(bnetserver
FOLDER
"server")
-if (WIN32)
+if (COPY_CONF AND WIN32)
if ("${CMAKE_MAKE_PROGRAM}" MATCHES "MSBuild")
add_custom_command(TARGET bnetserver
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/bnetserver.conf.dist ${CMAKE_BINARY_DIR}/bin/$(ConfigurationName)/
+ )
+ elseif (MINGW)
+ add_custom_command(TARGET bnetserver
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/bnetserver.conf.dist ${CMAKE_BINARY_DIR}/bin/
+ )
+ endif()
+endif()
+
+if (WIN32)
+ if ("${CMAKE_MAKE_PROGRAM}" MATCHES "MSBuild")
+ add_custom_command(TARGET bnetserver
+ POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/bnetserver.cert.pem ${CMAKE_BINARY_DIR}/bin/$(ConfigurationName)/
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/bnetserver.key.pem ${CMAKE_BINARY_DIR}/bin/$(ConfigurationName)/
)
elseif (MINGW)
add_custom_command(TARGET bnetserver
POST_BUILD
- COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/bnetserver.conf.dist ${CMAKE_BINARY_DIR}/bin/
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/bnetserver.cert.pem ${CMAKE_BINARY_DIR}/bin/
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/bnetserver.key.pem ${CMAKE_BINARY_DIR}/bin/
)
@@ -82,11 +94,15 @@ endif()
if (UNIX)
install(TARGETS bnetserver DESTINATION bin)
- install(FILES bnetserver.conf.dist DESTINATION ${CONF_DIR})
+ if (COPY_CONF)
+ install(FILES bnetserver.conf.dist DESTINATION ${CONF_DIR})
+ endif()
install(FILES bnetserver.cert.pem bnetserver.key.pem DESTINATION bin)
elseif (WIN32)
install(TARGETS bnetserver DESTINATION "${CMAKE_INSTALL_PREFIX}")
- install(FILES bnetserver.conf.dist DESTINATION "${CMAKE_INSTALL_PREFIX}")
+ if (COPY_CONF)
+ install(FILES bnetserver.conf.dist DESTINATION "${CMAKE_INSTALL_PREFIX}")
+ endif()
install(FILES bnetserver.cert.pem bnetserver.key.pem DESTINATION "${CMAKE_INSTALL_PREFIX}")
endif()
diff --git a/src/server/worldserver/CMakeLists.txt b/src/server/worldserver/CMakeLists.txt
index c9f6df06052..a07087056a0 100644
--- a/src/server/worldserver/CMakeLists.txt
+++ b/src/server/worldserver/CMakeLists.txt
@@ -73,7 +73,7 @@ if (WORLDSERVER_DYNAMIC_SCRIPT_MODULES_DEPENDENCIES)
add_dependencies(worldserver ${WORLDSERVER_DYNAMIC_SCRIPT_MODULES_DEPENDENCIES})
endif()
-if( WIN32 )
+if( COPY_CONF AND WIN32 )
if ( "${CMAKE_MAKE_PROGRAM}" MATCHES "MSBuild" )
add_custom_command(TARGET worldserver
POST_BUILD
@@ -89,10 +89,14 @@ endif()
if( UNIX )
install(TARGETS worldserver DESTINATION bin)
- install(FILES worldserver.conf.dist DESTINATION ${CONF_DIR})
+ if( COPY_CONF )
+ install(FILES worldserver.conf.dist DESTINATION ${CONF_DIR})
+ endif()
elseif( WIN32 )
install(TARGETS worldserver DESTINATION "${CMAKE_INSTALL_PREFIX}")
- install(FILES worldserver.conf.dist DESTINATION "${CMAKE_INSTALL_PREFIX}")
+ if( COPY_CONF )
+ install(FILES worldserver.conf.dist DESTINATION "${CMAKE_INSTALL_PREFIX}")
+ endif()
endif()
# Generate precompiled header