diff -urN -x '*.orig' nsync-1.20.2.orig/CMakeLists.txt nsync-1.20.2/CMakeLists.txt
--- nsync-1.20.2.orig/CMakeLists.txt	2019-01-04 05:29:33.000000000 +0800
+++ nsync-1.20.2/CMakeLists.txt	2019-03-03 17:41:18.480996400 +0800
@@ -78,7 +78,7 @@
 #    https://cmake.org/cmake/help/v3.1/policy/CMP0054.html
 
 # Pick the include directory for the operating system.
-if ("${CMAKE_SYSTEM_NAME}X" STREQUAL "WindowsX")
+if ("${CMAKE_SYSTEM_NAME}X" STREQUAL "WindowsX" AND MSVC)
 	include_directories ("${PROJECT_SOURCE_DIR}/platform/win32")
 	set (NSYNC_CPP_FLAGS "/TP")
 
@@ -297,6 +297,7 @@
 		${NSYNC_TEST_OS_SRC}
 	)
 	add_library (nsync_test ${NSYNC_TEST_SRC})
+	target_link_libraries (nsync_test nsync)
 	set_target_properties (nsync_test PROPERTIES
 		VERSION ${PROJECT_VERSION}
 		SOVERSION ${PROJECT_VERSION_MAJOR})
@@ -319,6 +320,7 @@
 	endforeach (t)
 
 	add_library (nsync_test_cpp ${NSYNC_TEST_CPP_SRC})
+	target_link_libraries (nsync_test_cpp nsync_cpp)
 	set_target_properties (nsync_test_cpp PROPERTIES
 		VERSION ${PROJECT_VERSION}
 		SOVERSION ${PROJECT_VERSION_MAJOR})
@@ -396,11 +398,13 @@
 
 set (CMAKE_SKIP_INSTALL_ALL_DEPENDENCY ON)
 
-install (TARGETS nsync
+install (TARGETS nsync EXPORT nsync
+	RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT RuntimeLibraries
 	LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT RuntimeLibraries
 	ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Development)
 
-install (TARGETS nsync_cpp OPTIONAL
+install (TARGETS nsync_cpp EXPORT nsync_cpp OPTIONAL
+	RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT RuntimeLibraries
 	LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT RuntimeLibraries
 	ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Development)
 
@@ -425,3 +429,11 @@
 		DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
 		COMPONENT Development)
 endforeach ()
+
+install(EXPORT nsync
+        DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/nsync
+        FILE        nsyncConfig.cmake)
+
+install(EXPORT nsync_cpp
+        DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/nsync_cpp
+        FILE        nsync_cppConfig.cmake)
