diff --git a/CMakeLists.txt b/CMakeLists.txt index 780917c1..024fbdca 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -50,6 +50,13 @@ if (BUILD_SHARED_LIBS) set(_GLFW_BUILD_DLL 1) endif() +if (BUILD_SHARED_LIBS AND UNIX) + # On Unix-like systems, shared libraries can use the soname system. + set(GLFW_LIB_NAME glfw) +else() + set(GLFW_LIB_NAME glfw3) +endif() + if (GLFW_USE_WAYLAND) set(GLFW_USE_EGL ON) elseif (GLFW_USE_MIR) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0d94b4a2..590a10f8 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -52,6 +52,7 @@ endif() add_library(glfw ${glfw_SOURCES} ${glfw_HEADERS}) set_target_properties(glfw PROPERTIES + OUTPUT_NAME ${GLFW_LIB_NAME} VERSION ${GLFW_VERSION} SOVERSION ${GLFW_VERSION_MAJOR} POSITION_INDEPENDENT_CODE ON @@ -105,13 +106,6 @@ if (MSVC) target_compile_definitions(glfw PRIVATE _CRT_SECURE_NO_WARNINGS) endif() -if (BUILD_SHARED_LIBS AND UNIX) - # On Unix-like systems, shared libraries can use the soname system. - set_target_properties(glfw PROPERTIES OUTPUT_NAME glfw) -else() - set_target_properties(glfw PROPERTIES OUTPUT_NAME glfw3) -endif() - if (GLFW_INSTALL) install(TARGETS glfw EXPORT glfwTargets DESTINATION lib${LIB_SUFFIX}) endif()