[build][cmake] Improve cmake config file generation (#4541)

* Improve cmake config file generation

This allows for finding raylib on a non-standard location (eg, not in /usr/lib{,64})

* Only have glfw as private if using internal glfw and not static
This commit is contained in:
Leonardo Guilherme de Freitas
2024-11-27 07:39:36 -03:00
committed by GitHub
parent 79188f570b
commit c53dd8a931
7 changed files with 43 additions and 110 deletions

View File

@@ -90,7 +90,16 @@ if (BUILD_SHARED_LIBS)
set_property(TARGET raylib PROPERTY C_VISIBILITY_PRESET hidden)
endif ()
target_link_libraries(raylib "${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