Skip to content

[build] Generated raylib.pc by CMake shouldn't define Libs.private: -lglfw #3265

@iacore

Description

@iacore

Reproduction

Do the following in shell:

# be in raylib repo
cmake -B build -D USE_EXTERNAL_GLFW=ON
cd build
ninja raylib/package # or some other build command
cat raylib/raylib.pc

What raylib/raylib.pc looks like

prefix=/usr/local
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include

Name: raylib
Description: A simple and easy-to-use library to enjoy videogames programming
URL: https://github.com/raysan5/raylib
Version: 4.5.0
Libs: -L"${libdir}" -lraylib 
Libs.private: -lglfw
Requires.private: glfw3
Cflags: -I"${includedir}"

What's the problem

The line Libs.private: -lglfw is not needed. It actually causes problem, because on my system, -lglfw3 is correct.

Once installed, the output of pkg-config --libs --static raylib will contain -lglfw (which is incorrect).

If you reproduce this again but without -D USE_EXTERNAL_GLFW=ON, the same problem exists. raylib.pc should now look like

Libs.private: -lglfw
Requires.private: 

... which is also wrong.

Workaround

After install, remove the line Libs.private: -lglfw in /usr/local/lib/pkgconfig/raylib.pc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions