From 8acface5040db8885fc8d803f8b22326ee0cbf5e Mon Sep 17 00:00:00 2001
From: Jonathan Hanks <jonathan.hanks@ligo.org>
Date: Wed, 9 Aug 2017 00:20:22 +0000
Subject: [PATCH] Partial revert of 4427.  To keep the source compatibile with
 the old build system, rename mx_stream.cc to mx_stream.c and do some cmake
 tricks to build it as C++.

git-svn-id: https://redoubt.ligo-wa.caltech.edu/svn/advLigoRTS/trunk@4430 6dcd42c9-f523-4c6d-aada-af552506706e
---
 src/mx_stream/CMakeLists.txt                | 6 +++++-
 src/mx_stream/{mx_stream.cc => mx_stream.c} | 2 --
 2 files changed, 5 insertions(+), 3 deletions(-)
 rename src/mx_stream/{mx_stream.cc => mx_stream.c} (99%)

diff --git a/src/mx_stream/CMakeLists.txt b/src/mx_stream/CMakeLists.txt
index dec566a6d..a8e960a1a 100644
--- a/src/mx_stream/CMakeLists.txt
+++ b/src/mx_stream/CMakeLists.txt
@@ -3,11 +3,15 @@ include(FindThreads)
 
 if (OPENMX_FOUND)
 
-    add_executable(mx_stream mx_stream.cc ${CMAKE_CURRENT_SOURCE_DIR}}/../drv/rfm.c)
+    # this is a weird area, these are .c files but need to be built as C++
+    # this should be fixed after we stop the manual makefile build
+    set (CMAKE_C_COMPILER ${CMAKE_CXX_COMPILER})
+    add_executable(mx_stream mx_stream.c ${CMAKE_CURRENT_SOURCE_DIR}}/../drv/rfm.c)
     target_compile_definitions(mx_stream PUBLIC -DNO_RTL -D_XOPEN_SOURCE -D_BSD_SOURCE)
     target_include_directories(mx_stream PUBLIC
             ${CMAKE_CURRENT_SOURCE_DIR}
             ${CMAKE_CURRENT_SOURCE_DIR}/../common
             ${CMAKE_CURRENT_SOURCE_DIR}/../common/bsd)
     target_link_libraries(mx_stream PUBLIC openmx::openmx ${MAKE_THREAD_LIBS_INIT})
+    set_target_properties(mx_stream PROPERTIES LINKER_LANGUAGE CXX)
 endif (OPENMX_FOUND)
diff --git a/src/mx_stream/mx_stream.cc b/src/mx_stream/mx_stream.c
similarity index 99%
rename from src/mx_stream/mx_stream.cc
rename to src/mx_stream/mx_stream.c
index 6ff633767..758488ce1 100644
--- a/src/mx_stream/mx_stream.cc
+++ b/src/mx_stream/mx_stream.c
@@ -56,9 +56,7 @@ volatile int threads_running;
 unsigned int do_wait = 0; // Wait for this number of milliseconds before starting a cycle
 unsigned int wait_delay = 4; // Wait before acknowledging sends with mx_wait() for this number of cycles times nsys
 
-extern "C" {
 extern void *findSharedMemory(char *);
-}
 
 void
 usage()
-- 
GitLab