--- java/module/CMakeLists.txt.orig
+++ java/module/CMakeLists.txt
@@ -94,9 +94,9 @@ if ( ENABLE_SWIG_JAVA )
     endforeach(_NDS_FILE ${built_java_sources})
 
     add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/nds2/connection_iterator.java
-                COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/connection_iterator.java ${CMAKE_CURRENT_BINARY_DIR}/nds2/connection_iterator.java
-                WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
-            )
+        COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/connection_iterator.java ${CMAKE_CURRENT_BINARY_DIR}/nds2/connection_iterator.java
+        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+        )
 
     set(CMAKE_SWIG_FLAGS -O -package nds2)
     set(CMAKE_SWIG_OUTDIR nds2)
@@ -120,35 +120,31 @@ if ( ENABLE_SWIG_JAVA )
         ARGS    -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_SWIG_OUTDIR}
         COMMAND ${SWIG_EXECUTABLE}
         ARGS    -java -c++ ${CMAKE_SWIG_FLAGS}
-                -I${CMAKE_CURRENT_BINARY_DIR}
-                -I${CMAKE_CURRENT_SOURCE_DIR}
-                -I${PROJECT_BINARY_DIR}/common/module
-                -I${PROJECT_SOURCE_DIR}/common/module
-                -o ${WRAPPER_FILE}
-                -outdir ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_SWIG_OUTDIR}
-                ${INTERFACE_FILE}
-    )
+        -I${CMAKE_CURRENT_BINARY_DIR}
+        -I${CMAKE_CURRENT_SOURCE_DIR}
+        -I${PROJECT_BINARY_DIR}/common/module
+        -I${PROJECT_SOURCE_DIR}/common/module
+        -o ${WRAPPER_FILE}
+        -outdir ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_SWIG_OUTDIR}
+        ${INTERFACE_FILE}
+        )
     # -------------------------------------------------------------------
     # swig_link_libraries(nds2JNI -static-libstdc++ ${JNI_LIBRARIES} $<TARGET_OBJECTS:ndswrapcxx_obj> ndsclient)
     # -------------------------------------------------------------------
     add_library( nds2JNI SHARED
         "${CMAKE_CURRENT_BINARY_DIR}/${WRAPPER_FILE}"
-    )
+        )
     target_link_libraries( nds2JNI
         -static-libstdc++
         ${CONLIBNDSCXX_OBJECTS}
         ${JNI_LIBRARIES}
         nds::daqc
-    )
+        )
     if( WIN32 )
         target_link_libraries( nds2JNI nds::cxx Ws2_32 )
     endif( WIN32 )
 
     target_requires_cpp11(nds2JNI PUBLIC)
-    if ( APPLE )
-        swig_add_library(nds2JNI_rpath LANGUAGE java SOURCES ${INTERFACE_FILE})
-        swig_link_libraries(nds2JNI_rpath ${JNI_LIBRARIES} nds::cxx)
-    endif ( APPLE )
     if (WIN32)
         #................................................................
         # Windows
@@ -161,59 +157,51 @@ if ( ENABLE_SWIG_JAVA )
         # Un*x / OSX
         #................................................................
         set_target_properties(nds2JNI
-    	    PROPERTIES
+    	      PROPERTIES
             LIBRARY_OUTPUT_DIRECTORY nds2
-    	    PREFIX lib
-    	    SUFFIX .jnilib)
+    	      PREFIX lib
+    	      SUFFIX .jnilib)
         if ( APPLE )
-            set_target_properties(nds2JNI_rpath
-    	        PROPERTIES
-                    BUILD_WITH_INSTALL_RPATH TRUE
-                    LIBRARY_OUTPUT_DIRECTORY rpath/nds2
-                    OUTPUT_NAME nds2JNI
-    	            PREFIX lib
-    	            SUFFIX .jnilib)
+            set_target_properties(nds2JNI
+    	          PROPERTIES
+                INSTALL_RPATH "${CMAKE_INSTALL_FULL_LIBDIR}"
+                BUILD_WITH_INSTALL_RPATH TRUE )
         endif ( APPLE )
     endif(WIN32)
 
     #--------------------------------------------------------------------
     # Build the JAR library
     #--------------------------------------------------------------------
-    message("################################ built_java_sources = ${built_java_sources}")
     add_jar(nds2 ${built_java_sources})
     add_dependencies(nds2 nds2JNI)
-    if ( APPLE )
-        add_jar(nds2_rpath ${built_java_sources})
-        add_dependencies(nds2_rpath nds2JNI_rpath)
-    endif ( APPLE )
     #--------------------------------------------------------------------
     # Build java documentation
     #--------------------------------------------------------------------
     if( NOT WIN32 )
-    create_javadoc(
-        nds2
-        FILES ${pathed_built_java_sources}
-        CLASSPATH ${CMAKE_JAVA_INCLUDE_PATH}
-        INSTALLPATH ${CMAKE_INSTALL_DATADIR}/nds2-client/java
-        WINDOWTITLE "NDS2 Client Interface"
-        DOCTITLE "<h1>NDS2 Client Interface</h1>"
-        AUTHOR TRUE
-        USE TRUE
-        VERSION TRUE
-    )
-    add_dependencies( nds2_javadoc nds2 )
+        create_javadoc(
+            nds2
+            FILES ${pathed_built_java_sources}
+            CLASSPATH ${CMAKE_JAVA_INCLUDE_PATH}
+            INSTALLPATH ${CMAKE_INSTALL_DATADIR}/nds2-client/java
+            WINDOWTITLE "NDS2 Client Interface"
+            DOCTITLE "<h1>NDS2 Client Interface</h1>"
+            AUTHOR TRUE
+            USE TRUE
+            VERSION TRUE
+            )
+        add_dependencies( nds2_javadoc nds2 )
     endif( NOT WIN32 )
 
     #--------------------------------------------------------------------
     # Create JAR of documentation
     #--------------------------------------------------------------------
     if( NOT WIN32 )
-    add_custom_target(nds2_javadoc_jar
-        ALL
-        COMMAND ${CMAKE_COMMAND} -E echo ${JAVA_ARCHIVE} -cvf ${CMAKE_CURRENT_BINARY_DIR}/nds2_javadoc.jar "."
-    	COMMAND ${JAVA_ARCHIVE} -cvf ${CMAKE_CURRENT_BINARY_DIR}/nds2_javadoc.jar "."
-    	WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/javadoc/nds2"
-    	DEPENDS nds2_javadoc)
+        add_custom_target(nds2_javadoc_jar
+            ALL
+            COMMAND ${CMAKE_COMMAND} -E echo ${JAVA_ARCHIVE} -cvf ${CMAKE_CURRENT_BINARY_DIR}/nds2_javadoc.jar "."
+    	      COMMAND ${JAVA_ARCHIVE} -cvf ${CMAKE_CURRENT_BINARY_DIR}/nds2_javadoc.jar "."
+    	      WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/javadoc/nds2"
+    	      DEPENDS nds2_javadoc)
     endif( NOT WIN32 )
     #--------------------------------------------------------------------
     # Add the JNI library to the jar archive
@@ -221,27 +209,16 @@ if ( ENABLE_SWIG_JAVA )
     add_custom_target(nds2JNIinclusion
         ALL
         COMMAND ${CMAKE_COMMAND} -E copy
-            $<TARGET_FILE_DIR:nds2JNI>/$<TARGET_FILE_NAME:nds2JNI> "${CMAKE_CURRENT_BINARY_DIR}/nds2"
-    	COMMAND ${JAVA_ARCHIVE} uvf ${CMAKE_CURRENT_BINARY_DIR}/nds2.jar "nds2/$<TARGET_FILE_NAME:nds2JNI>"
-    	DEPENDS nds2)
-    if ( APPLE )
-        add_custom_target(nds2JNIinclusion_rpath
-            ALL
-            COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CURRENT_BINARY_DIR}/rpath/nds2/"
-            COMMAND ${CMAKE_COMMAND} -E copy
-                $<TARGET_FILE_DIR:nds2JNI_rpath>/$<TARGET_FILE_NAME:nds2JNI_rpath> "${CMAKE_CURRENT_BINARY_DIR}/rpath/nds2"
-    	    COMMAND ${JAVA_ARCHIVE} uvf ${CMAKE_CURRENT_BINARY_DIR}/nds2_rpath.jar -C "${CMAKE_CURRENT_BINARY_DIR}/rpath" "nds2/$<TARGET_FILE_NAME:nds2JNI_rpath>"
-    	        DEPENDS nds2_rpath)
-        set( FILENAME_NDS2_JAR "${CMAKE_CURRENT_BINARY_DIR}/nds2_rpath.jar" )
-    else ( APPLE )
-        set( FILENAME_NDS2_JAR "${CMAKE_CURRENT_BINARY_DIR}/nds2.jar" )
-    endif ( APPLE )
+        $<TARGET_FILE_DIR:nds2JNI>/$<TARGET_FILE_NAME:nds2JNI> "${CMAKE_CURRENT_BINARY_DIR}/nds2"
+    	  COMMAND ${JAVA_ARCHIVE} uvf ${CMAKE_CURRENT_BINARY_DIR}/nds2.jar "nds2/$<TARGET_FILE_NAME:nds2JNI>"
+    	  DEPENDS nds2)
+    set( FILENAME_NDS2_JAR "${CMAKE_CURRENT_BINARY_DIR}/nds2.jar" )
     #====================================================================
     # Report the configuration
     #====================================================================
     configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/nds2-client-java.cfg.in
         ${CMAKE_CURRENT_BINARY_DIR}/nds2-client-java.cfg
-	@ONLY )
+	      @ONLY )
     #====================================================================
     # Distribution rules
     #====================================================================
@@ -256,32 +233,32 @@ if ( ENABLE_SWIG_JAVA )
     install(
         FILES "${FILENAME_NDS2_JAR}"
         RENAME "nds2.jar"
-	DESTINATION ${CMAKE_INSTALL_LIBDIR}/nds2-client/java
-	COMPONENT JAVA
-    )
+	      DESTINATION ${CMAKE_INSTALL_LIBDIR}/nds2-client/java
+	      COMPONENT JAVA
+        )
     if ( NOT WIN32 )
         install(
             FILES ${CMAKE_CURRENT_BINARY_DIR}/nds2_javadoc.jar
             DESTINATION ${CMAKE_INSTALL_LIBDIR}/nds2-client/java
             COMPONENT JAVA
-        )
+            )
     endif ( NOT WIN32 )
     foreach(_NDS_FILE ${built_java_classes})
-	install(
+	      install(
             FILES ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/nds2.dir/nds2/${_NDS_FILE}
-	    DESTINATION ${CMAKE_INSTALL_LIBDIR}/nds2-client/java/nds2
-	    COMPONENT JAVA)
+	          DESTINATION ${CMAKE_INSTALL_LIBDIR}/nds2-client/java/nds2
+	          COMPONENT JAVA)
     endforeach(_NDS_FILE)
 
     install(TARGETS nds2JNI
-	    DESTINATION ${CMAKE_INSTALL_LIBDIR}/java/nds2
-	    COMPONENT JAVA)
+	      DESTINATION ${CMAKE_INSTALL_LIBDIR}/java/nds2
+	      COMPONENT JAVA)
     if (WIN32)
-      install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/libnds2JNI.jnilib
-	  DESTINATION ${CMAKE_INSTALL_LIBDIR}/java/nds2
-          COMPONENT JAVA)
+        install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/libnds2JNI.jnilib
+	          DESTINATION ${CMAKE_INSTALL_LIBDIR}/java/nds2
+            COMPONENT JAVA)
     endif(WIN32)
-    
+
     set_nds_java_library_dir( "Release" )
     set_nds_java_library_dir( "Debug" )