mirror of https://github.com/raysan5/raylib
CMake: fix dependency build with -Draylib_USE_STATIC_LIBS=ON
Fixes #899, which made apparent three issues with how static libraries are handled in raylib-config.cmake: - XPREFIX is set before pkg_check_modules, which causes a duplicate STATIC in variables, e.g. PC_RAYLIB_STATIC_STATIC_.* - raylib_static is searched for, but no library exists with that name - raylib_LDFLAGS isn't populated properly This commit fixes these.
This commit is contained in:
parent
7b448f59e2
commit
47137b1489
|
@ -12,12 +12,14 @@
|
|||
# raylib_DEFINITIONS - Compiler switches required for using raylib
|
||||
|
||||
set(XPREFIX PC_RAYLIB)
|
||||
|
||||
find_package(PkgConfig QUIET)
|
||||
pkg_check_modules(${XPREFIX} QUIET raylib)
|
||||
|
||||
if (raylib_USE_STATIC_LIBS)
|
||||
set(XPREFIX ${XPREFIX}_STATIC)
|
||||
endif()
|
||||
|
||||
find_package(PkgConfig QUIET)
|
||||
pkg_check_modules(${XPREFIX} QUIET raylib)
|
||||
set(raylib_DEFINITIONS ${${XPREFIX}_CFLAGS})
|
||||
|
||||
find_path(raylib_INCLUDE_DIR
|
||||
|
@ -25,17 +27,16 @@ find_path(raylib_INCLUDE_DIR
|
|||
HINTS ${${XPREFIX}_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
set(RAYLIB_NAMES raylib)
|
||||
|
||||
if (raylib_USE_STATIC_LIBS)
|
||||
find_library(raylib_LIBRARY
|
||||
NAMES raylib_static
|
||||
HINTS ${${XPREFIX}_LIBRARY_DIRS}
|
||||
)
|
||||
else ()
|
||||
find_library(raylib_LIBRARY
|
||||
NAMES raylib
|
||||
HINTS ${${XPREFIX}_LIBRARY_DIRS}
|
||||
)
|
||||
endif ()
|
||||
set(RAYLIB_NAMES libraylib.a raylib.lib ${RAYLIB_NAMES})
|
||||
endif()
|
||||
|
||||
find_library(raylib_LIBRARY
|
||||
NAMES ${RAYLIB_NAMES}
|
||||
HINTS ${${XPREFIX}_LIBRARY_DIRS}
|
||||
)
|
||||
|
||||
set(raylib_LIBRARIES ${raylib_LIBRARY})
|
||||
set(raylib_LIBRARY_DIRS ${${XPREFIX}_LIBRARY_DIRS})
|
||||
|
|
Loading…
Reference in New Issue