Only have glfw as private if using internal glfw and not static

This commit is contained in:
Leonardo 2024-11-25 22:33:27 -03:00
parent 246ec831df
commit 24680e1c48
3 changed files with 11 additions and 5 deletions

View File

@ -12,6 +12,7 @@ endif()
# Also adding only on desktop (web also uses glfw but it is more limited and is added using an emcc linker flag)
if(NOT glfw3_FOUND AND NOT USE_EXTERNAL_GLFW STREQUAL "ON" AND "${PLATFORM}" MATCHES "Desktop")
MESSAGE(STATUS "Using raylib's GLFW")
set(INTERNAL_GLFW ON CACHE INTERNAL "" FORCE)
set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)

View File

@ -125,7 +125,3 @@ if (NOT GRAPHICS)
endif ()
set(LIBS_PRIVATE ${LIBS_PRIVATE} ${OPENAL_LIBRARY})
if (${PLATFORM} MATCHES "Desktop")
set(LIBS_PRIVATE ${LIBS_PRIVATE} glfw)
endif ()

View File

@ -90,7 +90,16 @@ if (BUILD_SHARED_LIBS)
set_property(TARGET raylib PROPERTY C_VISIBILITY_PRESET hidden)
endif ()
target_link_libraries(raylib PRIVATE "${LIBS_PRIVATE}")
# If building as a static lib *AND* using internal GLFW we
# need to set it up as a PRIVATE import so cmake doesn't complain
# it isn't declared on an install rule
if (INTERNAL_GLFW AND BUILD_SHARED_LIBS)
target_link_libraries(raylib PRIVATE glfw)
endif()
target_link_libraries(raylib PUBLIC "${LIBS_PRIVATE}")
# Sets some compile time definitions for the pre-processor
# If CUSTOMIZE_BUILD option is on you will not use config.h by default