Skip to content

Commit

Permalink
Gtk: Use GNUInstallDirs.
Browse files Browse the repository at this point in the history
  • Loading branch information
bearoso committed Aug 24, 2023
1 parent d0c45f3 commit 19d0016
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions gtk/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ option(DANGEROUS_HACKS "Allow dangerous hacks to be used" ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_INSTALL_DATADIR "snes9x" CACHE STRING "cheats.bml directory")
set(CMAKE_INSTALL_LOCALEDIR locale CACHE STRING "Locale directory")

include(GNUInstallDirs)

This comment has been minimized.

Copy link
@JakeSmarter

JakeSmarter Aug 25, 2023

Contributor

Hence, I have set CMAKE_INSTALL_LOCALEDIR to share/locale (seems reasonable) on my branch and now everything works as expected.

You have included the GNUInstallDirs module. 👍 This is a lot better!

Besides, prefixing project specific variables with CMAKE_ is unconventional at best and leads to confusion at worst. 🤭

Well, I guess GNUInstallDirs is to blame for this. Some GNU_ variable name prefix might have been better. Anyway, I am happy this has been clarified. 🤔 On second thought, I should file a bug/complaint with the GNUInstallDirs authors.


if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "One of: Debug Release RelWithDebInfo MinSizeRel" FORCE)
endif(NOT CMAKE_BUILD_TYPE)

string(APPEND DATADIR ${CMAKE_INSTALL_PREFIX} "/" ${CMAKE_INSTALL_DATAROOTDIR} "/" ${CMAKE_INSTALL_DATADIR})
string(APPEND LOCALEDIR ${CMAKE_INSTALL_PREFIX} "/" ${CMAKE_INSTALL_DATAROOTDIR} "/" ${CMAKE_INSTALL_LOCALEDIR})
string(APPEND DATADIR ${CMAKE_INSTALL_PREFIX} "/" ${CMAKE_INSTALL_DATAROOTDIR} "/snes9x")
string(APPEND LOCALEDIR ${CMAKE_INSTALL_PREFIX} "/" ${CMAKE_INSTALL_DATAROOTDIR} "/locale" )
add_compile_definitions(HAVE_LIBPNG
ZLIB SNES9X_GTK
NETPLAY_SUPPORT
Expand Down Expand Up @@ -406,7 +406,7 @@ if(USE_SLANG)
endif()

install(TARGETS snes9x-gtk)
install(FILES ../data/cheats.bml DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${CMAKE_INSTALL_DATADIR})
install(FILES ../data/cheats.bml DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/snes9x)
install(FILES data/snes9x-gtk.desktop DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications)
install(FILES data/snes9x_16x16.png DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/16x16/apps RENAME snes9x.png)
install(FILES data/snes9x_24x24.png DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/24x24/apps RENAME snes9x.png)
Expand Down

0 comments on commit 19d0016

Please sign in to comment.