From: TimePath Date: Mon, 31 Jul 2017 10:48:39 +0000 (+1000) Subject: CMake: install all tools X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=5d82e4d3c8043da1c394a76b1e1e65dfce191254;p=xonotic%2Fnetradiant.git CMake: install all tools --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 6876c362..f30b0a2e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -152,10 +152,6 @@ endif () # Radiant #----------------------------------------------------------------------- -if (BUILD_RADIANT) - add_subdirectory(radiant build) -endif () - if (CMAKE_EXECUTABLE_SUFFIX) string(REGEX REPLACE "^[.]" "" RADIANT_EXECUTABLE ${CMAKE_EXECUTABLE_SUFFIX}) else () @@ -166,7 +162,26 @@ else () ) endif () +macro(radiant_tool name) + add_executable(${name} ${ARGN}) + install( + TARGETS ${name} + RUNTIME DESTINATION . + ) + if (NOT (CMAKE_EXECUTABLE_SUFFIX STREQUAL ".${RADIANT_EXECUTABLE}")) + add_custom_command(TARGET ${name} POST_BUILD + COMMAND ln -f -s "$" "${PROJECT_BINARY_DIR}/${name}.${RADIANT_EXECUTABLE}" + VERBATIM + ) + install(CODE "execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink \ + ${name}${CMAKE_EXECUTABLE_SUFFIX} \ + ${CMAKE_INSTALL_PREFIX}/${name}.${RADIANT_EXECUTABLE} \ + )") + endif () +endmacro() + if (BUILD_RADIANT) + add_subdirectory(radiant build) set_target_properties(radiant PROPERTIES COMPILE_DEFINITIONS RADIANT_EXECUTABLE="${RADIANT_EXECUTABLE}" ) diff --git a/radiant/CMakeLists.txt b/radiant/CMakeLists.txt index 89563063..cb384690 100644 --- a/radiant/CMakeLists.txt +++ b/radiant/CMakeLists.txt @@ -94,7 +94,7 @@ if (WIN32) list(APPEND RADIANTLIST multimon.cpp multimon.h) endif() -add_executable(radiant WIN32 radiant.rc ${RADIANTLIST}) +radiant_tool(radiant WIN32 radiant.rc ${RADIANTLIST}) target_link_libraries(radiant ${CMAKE_DL_LIBS} ${LIBXML2_LIBRARIES} @@ -130,8 +130,3 @@ if (X11_LIBRARIES) endif () copy_dlls(radiant) - -install( - TARGETS radiant - RUNTIME DESTINATION . -) diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index ad32a079..1fcce20f 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -1,13 +1,3 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}") -macro(radiant_tool name) - add_executable(${name} ${ARGN}) - if (NOT (CMAKE_EXECUTABLE_SUFFIX STREQUAL ".${RADIANT_EXECUTABLE}")) - add_custom_command(TARGET ${name} POST_BUILD - COMMAND ln -f -s "$" "${PROJECT_BINARY_DIR}/${name}.${RADIANT_EXECUTABLE}" - VERBATIM - ) - endif () -endmacro() - add_subdirectory(quake3)