--- src/CMakeLists.txt.orig
+++ src/CMakeLists.txt
@@ -156,8 +156,10 @@
         # Add -fno-common to work around a bug in Apple's GCC
         target_compile_options(glfw PRIVATE "-fno-common")
 
-        set_target_properties(glfw PROPERTIES
-                              INSTALL_NAME_DIR "${CMAKE_INSTALL_LIBDIR}")
+        if (NOT CMAKE_INSTALL_NAME_DIR)
+          set_target_properties(glfw PROPERTIES
+            INSTALL_NAME_DIR "${CMAKE_INSTALL_LIBDIR}")
+        endif()
     endif()
 
     if (UNIX)