Add pkg-config files, optionally installed by CMake on Linux builds.
The modules provided are: - sfml-system - sfml-graphics - sfml-window - sfml-audio - sfml-network - sfml-all (depends on all the above modules) They are installed to ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/pkgconfig/ which is the standard location for pkg-config files on Linux. An example use if using autotools: # configure.ac AC_INIT([sfml-example],[1.0],[example@example.com]) AM_INIT_AUTOMAKE([foreign]) AC_PROG_CXX PKG_CHECK_MODULES([sfml], [sfml-all >= 2.0.0], [], [AC_MSG_ERROR([SFML is required])]) AC_CONFIG_FILES([Makefile]) AC_OUTPUT # Makefile.am bin_PROGRAMS = sfml_example sfml_example_SOURCES = src/sfml_example.cpp sfml_example_CFLAGS = $(sfml_CFLAGS) sfml_example_LIBS = $(sfml_LIBS) An example if using hand-written Makefiles: # Makefile sfml-example: src/sfml-example.cpp g++ `pkg-config --cflags --libs sfml-all` -o $@ $^
This commit is contained in:
parent
adca58059c
commit
2ac7653608
7 changed files with 85 additions and 0 deletions
|
@ -127,6 +127,26 @@ if(MACOSX)
|
|||
endif()
|
||||
endif()
|
||||
|
||||
if(LINUX)
|
||||
if(BUILD_SHARED_LIBS)
|
||||
sfml_set_option(INSTALL_PKGCONFIG_FILES TRUE BOOL "TRUE to automatically install pkg-config files so other projects can find SFML")
|
||||
if(INSTALL_PKGCONFIG_FILES)
|
||||
foreach(sfml_module IN ITEMS all system window graphics audio network)
|
||||
CONFIGURE_FILE(
|
||||
"tools/pkg-config/sfml-${sfml_module}.pc.in"
|
||||
"tools/pkg-config/sfml-${sfml_module}.pc"
|
||||
@ONLY)
|
||||
INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/tools/pkg-config/sfml-${sfml_module}.pc"
|
||||
DESTINATION "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/pkgconfig")
|
||||
endforeach()
|
||||
endif()
|
||||
else()
|
||||
if(INSTALL_PKGCONFIG_FILES)
|
||||
message(WARNING "No pkg-config files are provided for the static SFML libraries (INSTALL_PKGCONFIG_FILES will be ignored).")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# add the subdirectories
|
||||
add_subdirectory(src/SFML)
|
||||
if(BUILD_EXAMPLES)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue