--- bullet3-2.87/examples/RobotSimulator/CMakeLists.txt.orig	2017-09-30 02:20:39.000000000 +0300
+++ bullet3-2.87/examples/RobotSimulator/CMakeLists.txt	2018-05-16 07:58:55.914386600 +0300
@@ -81,32 +81,6 @@
 		
 )
 
-IF(BUILD_CLSOCKET)
- ADD_DEFINITIONS(-DBT_ENABLE_CLSOCKET)
-ENDIF(BUILD_CLSOCKET)
-
-IF(WIN32)
-	LINK_LIBRARIES(
-		${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY}
-	)
-	IF(BUILD_ENET)
-		ADD_DEFINITIONS(-DWIN32 -DBT_ENABLE_ENET)
-	ENDIF(BUILD_ENET)
-	IF(BUILD_CLSOCKET)
-		ADD_DEFINITIONS(-DWIN32)
-	ENDIF(BUILD_CLSOCKET)
-
-ELSE(WIN32)
-	IF(BUILD_ENET)
-		ADD_DEFINITIONS(-DHAS_SOCKLEN_T -DBT_ENABLE_ENET)
-	ENDIF(BUILD_ENET)
-
-	IF(BUILD_CLSOCKET)	
-		ADD_DEFINITIONS(${OSDEF})
-	ENDIF(BUILD_CLSOCKET)
-ENDIF(WIN32)
-
-
 IF(BUILD_ENET)
 	set(RobotSimulator_SRCS ${RobotSimulator_SRCS} 
 		../../examples/SharedMemory/PhysicsClientUDP.cpp
@@ -137,6 +111,38 @@
 	)
 ENDIF()
 
+ADD_EXECUTABLE(App_RobotSimulator  ${RobotSimulator_SRCS})
+
+SET_TARGET_PROPERTIES(App_RobotSimulator PROPERTIES VERSION ${BULLET_VERSION})
+SET_TARGET_PROPERTIES(App_RobotSimulator PROPERTIES DEBUG_POSTFIX "_d")
+
+TARGET_LINK_LIBRARIES(App_RobotSimulator BulletExampleBrowserLib BulletFileLoader BulletWorldImporter BulletSoftBody BulletDynamics BulletCollision BulletInverseDynamicsUtils BulletInverseDynamics LinearMath OpenGLWindow gwen BussIK Bullet3Common)
+
+IF(BUILD_CLSOCKET)
+ ADD_DEFINITIONS(-DBT_ENABLE_CLSOCKET)
+ENDIF(BUILD_CLSOCKET)
+
+IF(WIN32)
+	TARGET_LINK_LIBRARIES(App_RobotSimulator
+		${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} winmm
+	)
+	IF(BUILD_ENET)
+		ADD_DEFINITIONS(-DWIN32 -DBT_ENABLE_ENET)
+	ENDIF(BUILD_ENET)
+	IF(BUILD_CLSOCKET)
+		ADD_DEFINITIONS(-DWIN32)
+	ENDIF(BUILD_CLSOCKET)
+
+ELSE(WIN32)
+	IF(BUILD_ENET)
+		ADD_DEFINITIONS(-DHAS_SOCKLEN_T -DBT_ENABLE_ENET)
+	ENDIF(BUILD_ENET)
+
+	IF(BUILD_CLSOCKET)	
+		ADD_DEFINITIONS(${OSDEF})
+	ENDIF(BUILD_CLSOCKET)
+ENDIF(WIN32)
+
 
 #some code to support OpenGL and Glew cross platform
 IF (WIN32)
@@ -144,7 +150,7 @@
 			${BULLET_PHYSICS_SOURCE_DIR}/btgui/OpenGLWindow/GlewWindows
 	)
 	ADD_DEFINITIONS(-DGLEW_STATIC)
-	LINK_LIBRARIES( ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} )
+	TARGET_LINK_LIBRARIES(App_RobotSimulator ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} )
 ELSE(WIN32)
 	IF(APPLE)
 		find_library(COCOA NAMES Cocoa)
@@ -164,20 +170,9 @@
 ENDIF(WIN32)
 
 
-ADD_EXECUTABLE(App_RobotSimulator  ${RobotSimulator_SRCS})
-
-SET_TARGET_PROPERTIES(App_RobotSimulator PROPERTIES VERSION ${BULLET_VERSION})
-SET_TARGET_PROPERTIES(App_RobotSimulator PROPERTIES DEBUG_POSTFIX "_d")
-
-
 IF(WIN32)
 	IF(BUILD_ENET OR BUILD_CLSOCKET)
 		TARGET_LINK_LIBRARIES(App_RobotSimulator ws2_32 )
 	ENDIF(BUILD_ENET OR BUILD_CLSOCKET)
 ENDIF(WIN32)
 
-
-
-TARGET_LINK_LIBRARIES(App_RobotSimulator BulletExampleBrowserLib BulletFileLoader BulletWorldImporter BulletSoftBody BulletDynamics BulletCollision BulletInverseDynamicsUtils BulletInverseDynamics LinearMath OpenGLWindow gwen BussIK Bullet3Common)
-
-
--- bullet3-2.87/examples/pybullet/CMakeLists.txt.orig	2017-09-30 02:20:39.000000000 +0300
+++ bullet3-2.87/examples/pybullet/CMakeLists.txt	2018-05-16 08:04:44.198799300 +0300
@@ -149,18 +149,13 @@
 SET_TARGET_PROPERTIES(pybullet PROPERTIES SOVERSION ${BULLET_VERSION})
 SET_TARGET_PROPERTIES(pybullet PROPERTIES DEBUG_POSTFIX "_d")
 
+TARGET_LINK_LIBRARIES(pybullet BulletExampleBrowserLib BulletFileLoader BulletWorldImporter BulletSoftBody BulletDynamics BulletCollision BulletInverseDynamicsUtils BulletInverseDynamics LinearMath OpenGLWindow gwen BussIK Bullet3Common ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} ${PYTHON_LIBRARIES})
 
 IF(WIN32)
 	IF(BUILD_PYBULLET_ENET OR BUILD_PYBULLET_CLSOCKET)
-		TARGET_LINK_LIBRARIES(pybullet ws2_32 )
+		TARGET_LINK_LIBRARIES(pybullet ws2_32 winmm)
 	ENDIF(BUILD_PYBULLET_ENET OR BUILD_PYBULLET_CLSOCKET)
 
 	SET_TARGET_PROPERTIES(pybullet PROPERTIES SUFFIX ".pyd" )
 ENDIF(WIN32)
 
-
-
-
-TARGET_LINK_LIBRARIES(pybullet BulletExampleBrowserLib BulletFileLoader BulletWorldImporter BulletSoftBody BulletDynamics BulletCollision BulletInverseDynamicsUtils BulletInverseDynamics LinearMath OpenGLWindow gwen BussIK Bullet3Common ${PYTHON_LIBRARIES})
-
-
--- bullet3-2.87/Extras/BulletRobotics/CMakeLists.txt.orig	2018-05-16 08:28:43.585458800 +0300
+++ bullet3-2.87/Extras/BulletRobotics/CMakeLists.txt	2018-05-16 08:32:14.466629200 +0300
@@ -165,6 +165,12 @@
 	TARGET_LINK_LIBRARIES(BulletRobotics BulletInverseDynamicsUtils BulletWorldImporter BulletFileLoader BulletSoftBody BulletDynamics BulletCollision BulletInverseDynamics LinearMath Bullet3Common)
 ENDIF (BUILD_SHARED_LIBS)
 
+IF(WIN32)
+	IF(BUILD_ENET OR BUILD_CLSOCKET)
+		TARGET_LINK_LIBRARIES(BulletRobotics ws2_32 winmm)
+	ENDIF(BUILD_ENET OR BUILD_CLSOCKET)
+ENDIF(WIN32)
+
 IF (INSTALL_EXTRA_LIBS)
 	INSTALL(FILES
 		../../examples/SharedMemory/PhysicsClientC_API.h
