From ebd2332ea0113d5da45b44457cab7ae6befd6f38 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Sat, 18 Jan 2020 20:34:01 +1000
Subject: Fix for Haiku


diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8d2d73b..470525d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -167,6 +167,15 @@ write_basic_package_version_file(
 )
 set(CMAKE_SIZEOF_VOID_P ${OLD_CMAKE_SIZEOF_VOID_P})
 
+if (HAIKU)
+install(TARGETS range-v3-concepts range-v3-meta range-v3 EXPORT range-v3-targets DESTINATION ${CMAKE_INSTALL_LIBDIR})
+install(EXPORT range-v3-targets FILE range-v3-targets.cmake DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/range-v3)
+install(FILES
+  ${CMAKE_CURRENT_BINARY_DIR}/range-v3-config-version.cmake
+  cmake/range-v3-config.cmake
+  DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/range-v3)
+install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} FILES_MATCHING PATTERN "*")
+else()
 install(TARGETS range-v3-concepts range-v3-meta range-v3 EXPORT range-v3-targets DESTINATION lib)
 install(EXPORT range-v3-targets FILE range-v3-targets.cmake DESTINATION lib/cmake/range-v3)
 install(FILES
@@ -174,5 +183,6 @@ install(FILES
   cmake/range-v3-config.cmake
   DESTINATION lib/cmake/range-v3)
 install(DIRECTORY include/ DESTINATION include FILES_MATCHING PATTERN "*")
+endif()
 
 export(EXPORT range-v3-targets FILE range-v3-config.cmake)
diff --git a/cmake/ranges_env.cmake b/cmake/ranges_env.cmake
index 6d808ca..04161cd 100644
--- a/cmake/ranges_env.cmake
+++ b/cmake/ranges_env.cmake
@@ -41,6 +41,11 @@ elseif(CMAKE_SYSTEM_NAME MATCHES "Linux")
   if (RANGES_VERBOSE_BUILD)
     message(STATUS "[range-v3]: system is Linux.")
   endif()
+elseif(CMAKE_SYSTEM_NAME MATCHES "Haiku")
+  set (RANGES_ENV_HAIKU TRUE)
+  if (RANGES_VERBOSE_BUILD)
+    message(STATUS "[range-v3]: system is Haiku.")
+  endif()
 elseif(CMAKE_SYSTEM_NAME MATCHES "Windows")
   set (RANGES_ENV_WINDOWS TRUE)
   if (RANGES_VERBOSE_BUILD)
-- 
2.24.1

