From 1e77a52b7138c555002f57db81ecabc8a555b3fc Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Sat, 12 Jan 2019 10:48:33 +0100
Subject: Build and packaging fixes


diff --git a/CMakeLists.txt b/CMakeLists.txt
index c29fa28..03b3c7b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -146,7 +146,6 @@ function(check_working_cxx_atomics varname additional_lib)
   include(CheckCXXSourceCompiles)
   include(CMakePushCheckState)
   cmake_push_check_state()
-  set(CMAKE_REQUIRED_FLAGS "-std=c++11")
   set(CMAKE_REQUIRED_LIBRARIES "${additional_lib}")
   set(CMAKE_REQUIRED_QUIET 1)
   CHECK_CXX_SOURCE_COMPILES("
@@ -445,7 +444,6 @@ qt5_add_resources(pulseview_RESOURCES_RCC ${CMAKE_BINARY_DIR}/translations.qrc)
 add_definitions(-DQT_NO_KEYWORDS)
 add_definitions(-D__STDC_LIMIT_MACROS)
 add_definitions(-Wall -Wextra)
-add_definitions(-std=c++11)
 add_definitions(-DBOOST_MATH_DISABLE_FLOAT128=1)
 
 if(ENABLE_FLOW)
@@ -505,6 +503,11 @@ else()
 	list(APPEND PULSEVIEW_LINK_LIBS ${PKGDEPS_LIBRARIES})
 endif()
 
+if(HAIKU)
+	# Why do we need to manually link in libsigrok dependencies on Haiku?
+	list(APPEND PULSEVIEW_LINK_LIBS network usb-1.0 zip ftdi1)
+endif()
+
 if(WIN32)
 	# On Windows we need to statically link the libqsvg imageformat
 	# plugin (and the QtSvg component) for SVG graphics/icons to work.
@@ -546,6 +549,10 @@ endif()
 #= Installation
 #-------------------------------------------------------------------------------
 
+# Install the executable.
+if(HAIKU)
+install(TARGETS ${PROJECT_NAME} DESTINATION apps/)
+else()
 # Install the executable.
 install(TARGETS ${PROJECT_NAME} DESTINATION bin/)
 
@@ -564,6 +571,7 @@ install(FILES icons/pulseview.svg DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons
 
 # Generate Windows installer script.
 configure_file(contrib/pulseview_cross.nsi.in ${CMAKE_CURRENT_BINARY_DIR}/contrib/pulseview_cross.nsi @ONLY)
+endif(HAIKU)
 
 #===============================================================================
 #= Packaging (handled by CPack)
-- 
2.30.2

