Browse Source

CMake: Add Libs.private to Libs if installing static only

pkg-config --libs --static raylib and pkg-config --libs raylib
should give the same result if there is no shared raylib installed.
pull/577/head
Ahmad Fatoum 6 years ago
parent
commit
414bb6018b
No known key found for this signature in database GPG Key ID: C3EAC3DE9321D59B
2 changed files with 11 additions and 7 deletions
  1. +1
    -1
      raylib.pc.in
  2. +10
    -6
      src/CMakeLists.txt

+ 1
- 1
raylib.pc.in View File

@ -7,7 +7,7 @@ Name: raylib
Description: Simple and easy-to-use library to learn videogames programming
URL: http://github.com/raysan5/raylib
Version: @PROJECT_VERSION@
Libs: -L${libdir} -lraylib
Libs: -L${libdir} -lraylib @PKG_CONFIG_LIBS_EXTRA@
Libs.private: @PKG_CONFIG_LIBS_PRIVATE@
Requires.private: @GLFW_PKG_DEPS@
Cflags: -I${includedir}

+ 10
- 6
src/CMakeLists.txt View File

@ -110,6 +110,8 @@ if(${SHARED})
PUBLIC ${GRAPHICS}
)
set(PKG_CONFIG_LIBS_EXTRA "")
set_property(TARGET ${RAYLIB}_shared PROPERTY POSITION_INDEPENDENT_CODE ON)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_LIBDIR}")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
@ -155,6 +157,11 @@ if(${STATIC})
add_library(${RAYLIB} STATIC ${sources})
target_compile_definitions(${RAYLIB}
PUBLIC ${PLATFORM}
PUBLIC ${GRAPHICS}
)
set(PKG_CONFIG_LIBS_PRIVATE ${__PKG_CONFIG_LIBS_PRIVATE} ${GLFW_PKG_LIBS})
string (REPLACE ";" " " PKG_CONFIG_LIBS_PRIVATE "${PKG_CONFIG_LIBS_PRIVATE}")
if (${PLATFORM} MATCHES "PLATFORM_DESKTOP")
@ -173,6 +180,9 @@ if(${STATIC})
add_test("pkg-config--static" ${PROJECT_SOURCE_DIR}/../cmake/test-pkgconfig.sh --static)
endif(${STATIC})
if (NOT DEFINED PKG_CONFIG_LIBS_EXTRA)
set(PKG_CONFIG_LIBS_EXTRA "${PKG_CONFIG_LIBS_PRIVATE}")
endif()
configure_file(../raylib.pc.in raylib.pc @ONLY)
install(FILES ${CMAKE_BINARY_DIR}/release/raylib.pc DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
@ -183,12 +193,6 @@ file(COPY "physac.h" DESTINATION ".")
file(COPY "raymath.h" DESTINATION ".")
file(COPY "audio.h" DESTINATION ".")
target_compile_definitions(${RAYLIB}
PUBLIC ${PLATFORM}
PUBLIC ${GRAPHICS}
)
# Print the flags for the user
message(STATUS "Compiling with the flags:")
message(STATUS " PLATFORM=" ${PLATFORM})

Loading…
Cancel
Save