]> git.xonotic.org Git - xonotic/netradiant.git/blobdiff - radiant/CMakeLists.txt
radiant: build netradiant as non-PIE binary on Linux to workaround a mime-type bug
[xonotic/netradiant.git] / radiant / CMakeLists.txt
index 05d79830fe4fa2b56bdcadedc996d9ed325cffc9..aa52ef32ed842f2a75f83a7b62468f7f56a5b7f9 100644 (file)
@@ -90,13 +90,14 @@ set(RADIANTLIST
     xmlstuff.cpp xmlstuff.h
     xywindow.cpp xywindow.h
 )
+
 if (WIN32)
     list(APPEND RADIANTLIST multimon.cpp multimon.h)
-endif()
+endif ()
 
-radiant_tool(radiant WIN32 radiant.rc ${RADIANTLIST})
-add_dependencies(radiant modules)
-target_link_libraries(radiant
+radiant_tool(${RADIANT_BASENAME} WIN32 radiant.rc ${RADIANTLIST})
+add_dependencies(${RADIANT_BASENAME} modules)
+target_link_libraries(${RADIANT_BASENAME}
     ${CMAKE_DL_LIBS}
     ${LIBXML2_LIBRARIES}
     ${OPENGL_gl_LIBRARY}
@@ -126,8 +127,20 @@ target_link_libraries(radiant
     uilib
     xmllib
 )
+
 if (X11_LIBRARIES)
-    target_link_libraries(radiant ${X11_LIBRARIES})
+    target_link_libraries(${RADIANT_BASENAME} ${X11_LIBRARIES})
 endif ()
 
-copy_dlls(radiant)
+# PIE executables were wrongly recognized as shared libraries on Linux
+# because of a mistake in the mime-type library.
+# Because of that it was not possible to launch such executables from
+# the file browser.
+# While the problem is fixed upstream, most distributions still ship
+# with a faulty mime-type library and may do for a long time.
+# See: https://gitlab.freedesktop.org/xdg/shared-mime-info/-/issues/11
+if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
+    target_link_libraries(${RADIANT_BASENAME} -no-pie)
+endif()
+
+copy_dlls(${RADIANT_BASENAME})