Skip to content

Commit

Permalink
Small optimizations for cmake (#611)
Browse files Browse the repository at this point in the history
* Avoid redundant branch for the condition Linux and Filesystem Hierarchy Standard

* Put translations back to own directory on MacOS
  • Loading branch information
tobiolo authored Mar 13, 2024
1 parent 11bb389 commit bce62bd
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,11 @@ target_link_libraries(

if(LINUX)
OPTION(TREESHEETS_RELOCATABLE_INSTALLATION "Install data relative to the treesheets binary, instead of respecting the Filesystem Hierarchy Standard" OFF)
include(GNUInstallDirs)
endif()

if(LINUX AND NOT TREESHEETS_RELOCATABLE_INSTALLATION)
include(GNUInstallDirs)

set(TREESHEETS_BINDIR ${CMAKE_INSTALL_BINDIR})
set(TREESHEETS_DOCDIR ${CMAKE_INSTALL_DOCDIR})
set(TREESHEETS_FULL_DOCDIR ${CMAKE_INSTALL_FULL_DOCDIR})
Expand All @@ -110,6 +111,10 @@ if(LINUX AND NOT TREESHEETS_RELOCATABLE_INSTALLATION)
target_compile_definitions(treesheets PRIVATE "LOCALEDIR=L\"${CMAKE_INSTALL_FULL_LOCALEDIR}\"")
target_compile_definitions(treesheets PRIVATE "TREESHEETS_DOCDIR=\"${TREESHEETS_FULL_DOCDIR}\"")
target_compile_definitions(treesheets PRIVATE "TREESHEETS_DATADIR=\"${TREESHEETS_FULL_PKGDATADIR}\"")

install(FILES linux/com.strlen.TreeSheets.svg DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/scalable/apps)
install(FILES linux/com.strlen.TreeSheets.desktop DESTINATION ${CMAKE_INSTALL_DATADIR}/applications)
install(FILES linux/com.strlen.TreeSheets.xml DESTINATION ${CMAKE_INSTALL_DATADIR}/mime/packages)
else()
set(TREESHEETS_BINDIR ${CMAKE_INSTALL_PREFIX})
set(TREESHEETS_DOCDIR ${CMAKE_INSTALL_PREFIX})
Expand Down Expand Up @@ -147,7 +152,7 @@ elseif(APPLE)
foreach(locale ${locales})
install(
FILES "TS/translations/${locale}/ts.mo"
DESTINATION "${CMAKE_INSTALL_PREFIX}/${locale}.lproj"
DESTINATION "${CMAKE_INSTALL_PREFIX}/translations/${locale}.lproj"
)
endforeach()
else()
Expand All @@ -159,9 +164,3 @@ else()
)
endforeach()
endif()

if(LINUX AND NOT TREESHEETS_RELOCATABLE_INSTALLATION)
install(FILES linux/com.strlen.TreeSheets.svg DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/scalable/apps)
install(FILES linux/com.strlen.TreeSheets.desktop DESTINATION ${CMAKE_INSTALL_DATADIR}/applications)
install(FILES linux/com.strlen.TreeSheets.xml DESTINATION ${CMAKE_INSTALL_DATADIR}/mime/packages)
endif()

0 comments on commit bce62bd

Please sign in to comment.