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.
This commit is contained in:
parent
758a774173
commit
414bb6018b
2 changed files with 11 additions and 7 deletions
|
@ -7,7 +7,7 @@ Name: raylib
|
||||||
Description: Simple and easy-to-use library to learn videogames programming
|
Description: Simple and easy-to-use library to learn videogames programming
|
||||||
URL: http://github.com/raysan5/raylib
|
URL: http://github.com/raysan5/raylib
|
||||||
Version: @PROJECT_VERSION@
|
Version: @PROJECT_VERSION@
|
||||||
Libs: -L${libdir} -lraylib
|
Libs: -L${libdir} -lraylib @PKG_CONFIG_LIBS_EXTRA@
|
||||||
Libs.private: @PKG_CONFIG_LIBS_PRIVATE@
|
Libs.private: @PKG_CONFIG_LIBS_PRIVATE@
|
||||||
Requires.private: @GLFW_PKG_DEPS@
|
Requires.private: @GLFW_PKG_DEPS@
|
||||||
Cflags: -I${includedir}
|
Cflags: -I${includedir}
|
||||||
|
|
|
@ -110,6 +110,8 @@ if(${SHARED})
|
||||||
PUBLIC ${GRAPHICS}
|
PUBLIC ${GRAPHICS}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
set(PKG_CONFIG_LIBS_EXTRA "")
|
||||||
|
|
||||||
set_property(TARGET ${RAYLIB}_shared PROPERTY POSITION_INDEPENDENT_CODE ON)
|
set_property(TARGET ${RAYLIB}_shared PROPERTY POSITION_INDEPENDENT_CODE ON)
|
||||||
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_LIBDIR}")
|
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_LIBDIR}")
|
||||||
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||||
|
@ -155,6 +157,11 @@ if(${STATIC})
|
||||||
|
|
||||||
add_library(${RAYLIB} STATIC ${sources})
|
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})
|
set(PKG_CONFIG_LIBS_PRIVATE ${__PKG_CONFIG_LIBS_PRIVATE} ${GLFW_PKG_LIBS})
|
||||||
string (REPLACE ";" " " PKG_CONFIG_LIBS_PRIVATE "${PKG_CONFIG_LIBS_PRIVATE}")
|
string (REPLACE ";" " " PKG_CONFIG_LIBS_PRIVATE "${PKG_CONFIG_LIBS_PRIVATE}")
|
||||||
if (${PLATFORM} MATCHES "PLATFORM_DESKTOP")
|
if (${PLATFORM} MATCHES "PLATFORM_DESKTOP")
|
||||||
|
@ -173,6 +180,9 @@ if(${STATIC})
|
||||||
add_test("pkg-config--static" ${PROJECT_SOURCE_DIR}/../cmake/test-pkgconfig.sh --static)
|
add_test("pkg-config--static" ${PROJECT_SOURCE_DIR}/../cmake/test-pkgconfig.sh --static)
|
||||||
endif(${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)
|
configure_file(../raylib.pc.in raylib.pc @ONLY)
|
||||||
install(FILES ${CMAKE_BINARY_DIR}/release/raylib.pc DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
|
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 "raymath.h" DESTINATION ".")
|
||||||
file(COPY "audio.h" DESTINATION ".")
|
file(COPY "audio.h" DESTINATION ".")
|
||||||
|
|
||||||
target_compile_definitions(${RAYLIB}
|
|
||||||
PUBLIC ${PLATFORM}
|
|
||||||
PUBLIC ${GRAPHICS}
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
# Print the flags for the user
|
# Print the flags for the user
|
||||||
message(STATUS "Compiling with the flags:")
|
message(STATUS "Compiling with the flags:")
|
||||||
message(STATUS " PLATFORM=" ${PLATFORM})
|
message(STATUS " PLATFORM=" ${PLATFORM})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue