From 5254fa8b7ca54fa440ca11ea5b6827edf5876569 Mon Sep 17 00:00:00 2001
From: begasus <begasus@gmail.com>
Date: Mon, 29 Apr 2019 11:26:31 +0200
Subject: Fix install paths, kudos to leorize for the patch


diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 6d1b8ab..6cd9357 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,6 +1,6 @@
 cmake_minimum_required(VERSION 2.8.12)
 project(flif)
- 
+
 include(GNUInstallDirs)
 include(FindPkgConfig)
 find_package(PNG REQUIRED)
@@ -67,7 +67,7 @@ set(COMMON_SOURCES
 )
 
 set(FLIF_DEC_FILES
-  ${FLIF_SRC_DIR}/library/flif_dec.h 
+  ${FLIF_SRC_DIR}/library/flif_dec.h
   ${FLIF_SRC_DIR}/library/flif-interface-private_dec.hpp
   ${FLIF_SRC_DIR}/library/flif-interface_dec.cpp)
 
@@ -168,8 +168,8 @@ if(BUILD_SHARED_LIBS)
 
     set_target_properties(flif_lib PROPERTIES OUTPUT_NAME flif)
     set_target_properties(flif_lib_dec PROPERTIES OUTPUT_NAME flif_dec)
-  
-    set_target_properties(flif_lib PROPERTIES PUBLIC_HEADER "${FLIF_ENC_HEADERS}" SOVERSION ${SOVERSION})   
+
+    set_target_properties(flif_lib PROPERTIES PUBLIC_HEADER "${FLIF_ENC_HEADERS}" SOVERSION ${SOVERSION})
     set_target_properties(flif_lib_dec PROPERTIES PUBLIC_HEADER "${FLIF_DEC_HEADERS}" SOVERSION ${SOVERSION})
 
     target_compile_definitions(flif_lib PRIVATE ${DEFINITIONS_FOR_ALL_TARGETS} FLIF_BUILD_DLL )
@@ -181,20 +181,20 @@ if(BUILD_SHARED_LIBS)
     target_link_libraries(flif_exe flif_lib)
     target_link_libraries(dflif_exe flif_lib_dec)
     install(TARGETS flif_lib flif_lib_dec
-      RUNTIME DESTINATION bin
-      LIBRARY DESTINATION lib
-      ARCHIVE DESTINATION lib
-      PUBLIC_HEADER DESTINATION include)
+      RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+      LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+      ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+      PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
 endif(BUILD_SHARED_LIBS)
 
 target_include_directories(flif_exe PRIVATE ${FLIF_SRC_DIR}/../extern)
 target_include_directories(dflif_exe PRIVATE ${FLIF_SRC_DIR}/../extern)
 install(TARGETS flif_exe dflif_exe
-    RUNTIME DESTINATION bin)
-install(FILES ${FLIF_SRC_DIR}/../tools/gif2flif 
-   PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_READ DESTINATION bin)
-install(FILES ${FLIF_SRC_DIR}/../tools/apng2flif 
-   PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_READ DESTINATION bin)
+    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+install(FILES ${FLIF_SRC_DIR}/../tools/gif2flif
+   PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_READ DESTINATION ${CMAKE_INSTALL_BINDIR})
+install(FILES ${FLIF_SRC_DIR}/../tools/apng2flif
+   PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_READ DESTINATION ${CMAKE_INSTALL_BINDIR})
 install(FILES ${FLIF_SRC_DIR}/../doc/flif.1
    DESTINATION ${CMAKE_INSTALL_FULL_MANDIR}/man1)
 
@@ -209,7 +209,7 @@ if(BUILD_STATIC_LIBS)
     set_target_properties(flif_lib_static PROPERTIES OUTPUT_NAME flif)
     set_target_properties(flif_lib_dec_static PROPERTIES OUTPUT_NAME flif_dec)
 
-    set_target_properties(flif_lib_static PROPERTIES PUBLIC_HEADER "${FLIF_ENC_HEADERS}" SOVERSION ${SOVERSION})   
+    set_target_properties(flif_lib_static PROPERTIES PUBLIC_HEADER "${FLIF_ENC_HEADERS}" SOVERSION ${SOVERSION})
     set_target_properties(flif_lib_dec_static PROPERTIES PUBLIC_HEADER "${FLIF_DEC_HEADERS}" SOVERSION ${SOVERSION})
 
     target_compile_definitions(flif_lib_static PRIVATE ${DEFINITIONS_FOR_ALL_TARGETS})
@@ -219,10 +219,10 @@ if(BUILD_STATIC_LIBS)
     target_include_directories(flif_lib_dec_static PRIVATE ${FLIF_SRC_DIR}/../extern)
 
     install(TARGETS flif_lib_static flif_lib_dec_static
-      RUNTIME DESTINATION bin
-      LIBRARY DESTINATION lib
-      ARCHIVE DESTINATION lib
-      PUBLIC_HEADER DESTINATION include)
+      RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+      LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+      ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+      PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
 
     if (NOT(BUILD_SHARED_LIBS))
        target_link_libraries(flif_exe flif_lib_static)
@@ -251,7 +251,7 @@ if(GDK_FOUND AND (BUILD_SHARED_LIBS OR BUILD_STATIC_LIBS))
     set_target_properties(pixbufloader-flif-static PROPERTIES OUTPUT_NAME pixbufloader-flif)
     if (BUILD_SHARED_LIBS)
        target_link_libraries(pixbufloader-flif flif_lib)
-       target_link_libraries(pixbufloader-flif-static flif_lib) 
+       target_link_libraries(pixbufloader-flif-static flif_lib)
     else()
        target_link_libraries(pixbufloader-flif flif_lib_static)
        target_link_libraries(pixbufloader-flif-static flif_lib_static)
@@ -261,15 +261,15 @@ if(GDK_FOUND AND (BUILD_SHARED_LIBS OR BUILD_STATIC_LIBS))
     execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=gdk_pixbuf_moduledir --dont-define-prefix gdk-pixbuf-2.0
        OUTPUT_VARIABLE GDK_MODULES_DIR ERROR_VARIABLE GDK_RES_ERROR RESULT_VARIABLE RES_VAR OUTPUT_STRIP_TRAILING_WHITESPACE)
     if (("${RES_VAR}" STREQUAL "") OR ("${RES_VAR}" STREQUAL "0"))
-           message(STATUS "gdk-pixbuf-2.0 module dir ${GDK_MODULES_DIR}")      
+           message(STATUS "gdk-pixbuf-2.0 module dir ${GDK_MODULES_DIR}")
     else()
            message(FATAL_ERROR "Error: ${RES_VAR}")
     endif(("${RES_VAR}" STREQUAL "") OR ("${RES_VAR}" STREQUAL "0"))
     if ("${GDK_RES_ERROR}" STREQUAL "")
-    install(TARGETS pixbufloader-flif pixbufloader-flif-static 
+    install(TARGETS pixbufloader-flif pixbufloader-flif-static
       RUNTIME DESTINATION ${GDK_MODULES_DIR}
       LIBRARY DESTINATION ${GDK_MODULES_DIR}
-      ARCHIVE DESTINATION ${GDK_MODULES_DIR}) 
+      ARCHIVE DESTINATION ${GDK_MODULES_DIR})
     else()
       message(FATAL_ERROR "Error: ${GDK_RES_ERROR}")
     endif("${GDK_RES_ERROR}" STREQUAL "")
@@ -319,7 +319,7 @@ if(${SDL2_FOUND} AND ${BUILD_SHARED_LIBS})
     target_include_directories(viewflif PRIVATE ${FLIF_SRC_DIR}/library ${SDL2_INCLUDE_DIR})
     target_compile_definitions(viewflif PRIVATE FLIF_USE_DLL)
     install(TARGETS viewflif
-      RUNTIME DESTINATION bin)
+      RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
 endif(${SDL2_FOUND} AND ${BUILD_SHARED_LIBS})
 
 # test
-- 
2.21.0

