--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -66,7 +66,7 @@
 set (NSYNC_OS_CPP_SRC
 	# Avoid use of the C++11 version of per_thread_waiter.  It behaves
 	# badly if multiple copies of nsync are linked into an address space.
-	"platform/posix/src/per_thread_waiter.c"
+	"platform/c++11/src/per_thread_waiter.cc"
 	"platform/c++11/src/yield.cc"
 	"platform/c++11/src/time_rep_timespec.cc"
 	"platform/c++11/src/nsync_panic.cc"
@@ -88,7 +88,7 @@
 endif ()
 
 # 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")
 
@@ -206,6 +206,9 @@
 	set (NSYNC_TEST_OS_SRC
 		"platform/posix/src/start_thread.c"
 	)
+	set (NSYNC_TEST_OS_CPP_SRC
+		"platform/c++11/src/start_thread.cc"
+	)
 endif ()
 
 # Pick the include directory for the architecture.
@@ -298,9 +301,9 @@
 		"testing/smprintf.c"
 		"testing/testing.c"
 		"testing/time_extra.c"
-		${NSYNC_TEST_OS_SRC}
 	)
-	add_library (nsync_test ${NSYNC_TEST_SRC})
+	add_library (nsync_test ${NSYNC_TEST_SRC} ${NSYNC_TEST_OS_SRC})
+	target_link_libraries (nsync_test nsync)
 	set_target_properties (nsync_test PROPERTIES
 		VERSION ${PROJECT_VERSION}
 		SOVERSION ${PROJECT_VERSION_MAJOR})
@@ -322,7 +325,8 @@
 		)
 	endforeach (t)
 
-	add_library (nsync_test_cpp ${NSYNC_TEST_CPP_SRC})
+	add_library (nsync_test_cpp ${NSYNC_TEST_CPP_SRC} ${NSYNC_TEST_OS_CPP_SRC})
+	target_link_libraries (nsync_test_cpp nsync_cpp)
 	set_target_properties (nsync_test_cpp PROPERTIES
 		VERSION ${PROJECT_VERSION}
 		SOVERSION ${PROJECT_VERSION_MAJOR})
@@ -401,10 +405,12 @@
 set (CMAKE_SKIP_INSTALL_ALL_DEPENDENCY ON)
 
 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 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)
 
