]> git.rm.cloudns.org Git - xonotic/netradiant.git/commitdiff
CMake: install all tools
authorTimePath <andrew.hardaker1995@gmail.com>
Mon, 31 Jul 2017 10:48:39 +0000 (20:48 +1000)
committerTimePath <andrew.hardaker1995@gmail.com>
Mon, 31 Jul 2017 10:48:39 +0000 (20:48 +1000)
CMakeLists.txt
radiant/CMakeLists.txt
tools/CMakeLists.txt

index 6876c362b5733905ca94fcaf222588152887a12a..f30b0a2ea0df9f88c8720dd753a59f59c56bcd7b 100644 (file)
@@ -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 "$<TARGET_FILE_NAME:${name}>" "${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}"
             )
index 895630638f7d626489d114d6b544e050dddbf951..cb384690ab5e9eac7b2032d2cc421bc07e6ba707 100644 (file)
@@ -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 .
-)
index ad32a079e7a66bbd3aa0f74058771393c3e50553..1fcce20fdd8c4161d8d12cb67b355c0846637b45 100644 (file)
@@ -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 "$<TARGET_FILE_NAME:${name}>" "${PROJECT_BINARY_DIR}/${name}.${RADIANT_EXECUTABLE}"
-                VERBATIM
-                )
-    endif ()
-endmacro()
-
 add_subdirectory(quake3)