summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAhmad Fatoum <[email protected]>2018-07-10 21:06:16 +0200
committerAhmad Fatoum <[email protected]>2018-07-10 21:20:01 +0200
commit414bb6018b1212dfa02e87769d37a7a2837ce6cf (patch)
treea2a7656f32b3cb26396a4fe17e8e984194ef007c
parent758a77417355a22d3210493446d76cb429c1429b (diff)
downloadraylib-414bb6018b1212dfa02e87769d37a7a2837ce6cf.tar.gz
raylib-414bb6018b1212dfa02e87769d37a7a2837ce6cf.zip
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.
-rw-r--r--raylib.pc.in2
-rw-r--r--src/CMakeLists.txt16
2 files changed, 11 insertions, 7 deletions
diff --git a/raylib.pc.in b/raylib.pc.in
index f72b3dce..c6d54389 100644
--- a/raylib.pc.in
+++ b/raylib.pc.in
@@ -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}
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 333bcf1d..05e3c0d2 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -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})