add a macro for directory copying

This commit is contained in:
Stephen Birarda 2015-04-30 13:06:00 -07:00
parent 17142a532f
commit 38ae3afc82
2 changed files with 16 additions and 32 deletions

View file

@ -34,4 +34,4 @@ macro(SETUP_HIFI_PROJECT)
foreach(QT_MODULE ${${TARGET_NAME}_DEPENDENCY_QT_MODULES})
target_link_libraries(${TARGET_NAME} Qt5::${QT_MODULE})
endforeach()
endmacro()
endmacro()

View file

@ -3,38 +3,22 @@ set(TARGET_NAME domain-server)
# setup the project and link required Qt modules
setup_hifi_project(Network)
# remove current resources dir
add_custom_command(
TARGET ${TARGET_NAME} POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E remove_directory
$<TARGET_FILE_DIR:${TARGET_NAME}>/resources
)
# copy all files in resources, including web
add_custom_command(
TARGET ${TARGET_NAME} POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E copy_directory
"${PROJECT_SOURCE_DIR}/resources"
$<TARGET_FILE_DIR:${TARGET_NAME}>/resources
)
if (NOT WIN32)
# remove the web directory so we can make it a symlink
add_custom_command(
TARGET ${TARGET_NAME} POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E remove_directory
$<TARGET_FILE_DIR:${TARGET_NAME}>/resources/web
)
# make the web directory a symlink
add_custom_command(
TARGET ${TARGET_NAME} POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E create_symlink
"${PROJECT_SOURCE_DIR}/resources/web"
$<TARGET_FILE_DIR:${TARGET_NAME}>/resources/web
)
if (UPPER_CMAKE_BUILD_TYPE MATCHES DEBUG AND NOT WIN32)
set(SHOULD_SYMLINK_RESOURCES FALSE)
else ()
set(SHOULD_SYMLINK_RESOURCES FALSE)
endif ()
copy_directory_beside_target(${SHOULD_SYMLINK_RESOURCES} "${CMAKE_CURRENT_SOURCE_DIR}/resources" "resources")
# copy all files in resources, including web
# add_custom_command(
# TARGET ${TARGET_NAME} POST_BUILD
# COMMAND "${CMAKE_COMMAND}" -E copy_directory
# "${PROJECT_SOURCE_DIR}/resources"
# $<TARGET_FILE_DIR:${TARGET_NAME}>/resources
# )
# link the shared hifi libraries
link_hifi_libraries(embedded-webserver networking shared)
@ -52,4 +36,4 @@ include_directories(SYSTEM "${OPENSSL_INCLUDE_DIR}")
# append OpenSSL to our list of libraries to link
target_link_libraries(${TARGET_NAME} ${OPENSSL_LIBRARIES})
copy_dlls_beside_windows_executable()
copy_dlls_beside_windows_executable()