@@ -86,6 +86,7 @@ cmake_dependent_option(ENABLE_PCIACCESS "Enable libpciaccess" ON "NetBSD OR Open
8686option (ENABLE_SYSTEM_YYJSON "Use system provided (instead of fastfetch embedded) yyjson library"  OFF )
8787option (ENABLE_ASAN "Build fastfetch with ASAN (address sanitizer)"  OFF )
8888option (ENABLE_LTO "Enable link-time optimization in release mode if supported"  ON )
89+ option (BUILD_FLASHFETCH "Build flashfetch"  ON ) # Also build the flashfetch binary 
8990option (BUILD_TESTS "Build tests"  OFF ) # Also create test executables 
9091option (SET_TWEAK "Add tweak to project version"  ON ) # This is set to off by github actions for release builds 
9192option (IS_MUSL "Build with musl libc"  OFF ) # Used by Github Actions 
@@ -1611,41 +1612,52 @@ target_link_libraries(fastfetch
16111612    PRIVATE  libfastfetch
16121613)
16131614
1614- add_executable (flashfetch
1615-     src/flashfetch.c
1616- )
1617- target_compile_definitions (flashfetch
1618-     PRIVATE  FASTFETCH_TARGET_BINARY_NAME=flashfetch
1619- )
1620- target_link_libraries (flashfetch
1621-     PRIVATE  libfastfetch
1622- )
1623- 
16241615# Prevent fastfetch from linking to libstdc++ 
16251616set (CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "" )
16261617set (CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES "" )
16271618set_target_properties (fastfetch PROPERTIES LINKER_LANGUAGE  C)
1628- set_target_properties (flashfetch PROPERTIES LINKER_LANGUAGE  C)
16291619
16301620if (WIN32 )
16311621    target_sources (fastfetch
16321622        PRIVATE  src/util/windows/version .rc
16331623    )
1634-     target_sources (flashfetch
1635-         PRIVATE  src/util/windows/version .rc
1636-     )
16371624elseif (APPLE )
16381625    target_link_options (fastfetch
16391626        PRIVATE  LINKER:-sectcreate,__TEXT,__info_plist,Info.plist
16401627    )
1641-     target_link_options (flashfetch
1642-         PRIVATE  LINKER:-sectcreate,__TEXT,__info_plist,Info.plist
1643-     )
16441628endif ()
16451629
16461630if (BINARY_LINK_TYPE STREQUAL  "static" )
16471631    target_link_options (fastfetch PRIVATE  "-static" )
1648-     target_link_options (flashfetch PRIVATE  "-static" )
1632+ endif ()
1633+ 
1634+ # Apply all above parameters to flashfetch if it is built 
1635+ if  (BUILD_FLASHFETCH)
1636+     add_executable (flashfetch
1637+         src/flashfetch.c
1638+     )
1639+     target_compile_definitions (flashfetch
1640+         PRIVATE  FASTFETCH_TARGET_BINARY_NAME=flashfetch
1641+     )
1642+     target_link_libraries (flashfetch
1643+         PRIVATE  libfastfetch
1644+     )
1645+ 
1646+     set_target_properties (flashfetch PROPERTIES LINKER_LANGUAGE  C)
1647+ 
1648+     if (WIN32 )
1649+         target_sources (flashfetch
1650+             PRIVATE  src/util/windows/version .rc
1651+         )
1652+     elseif (APPLE )
1653+         target_link_options (flashfetch
1654+             PRIVATE  LINKER:-sectcreate,__TEXT,__info_plist,Info.plist
1655+         )
1656+     endif ()
1657+ 
1658+     if (BINARY_LINK_TYPE STREQUAL  "static" )
1659+         target_link_options (flashfetch PRIVATE  "-static" )
1660+     endif ()
16491661endif ()
16501662
16511663################### 
@@ -1687,10 +1699,17 @@ endif()
16871699include (GNUInstallDirs)
16881700
16891701install (
1690-     TARGETS fastfetch flashfetch 
1702+     TARGETS fastfetch
16911703    DESTINATION  "${CMAKE_INSTALL_BINDIR} " 
16921704)
16931705
1706+ if  (TARGET  flashfetch)
1707+     install (
1708+         TARGETS flashfetch
1709+         DESTINATION  "${CMAKE_INSTALL_BINDIR} " 
1710+     )
1711+ endif ()
1712+ 
16941713if  (TARGET  ffwinrt)
16951714    install (
16961715        TARGETS ffwinrt
0 commit comments