Fixed the installation of pkg-config files
* Removed duplicated CMake code * Made it possible to manually specify the pkg-config path * Install pkg-config files by default on Linux and BSD systems
This commit is contained in:
parent
ff87e1c922
commit
9712bb1ec8
@ -269,30 +269,6 @@ if(SFML_OS_MACOSX)
|
|||||||
set(XCODE_TEMPLATES_ARCH "\$(NATIVE_ARCH_ACTUAL)")
|
set(XCODE_TEMPLATES_ARCH "\$(NATIVE_ARCH_ACTUAL)")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(SFML_OS_LINUX OR SFML_OS_FREEBSD OR SFML_OS_OPENBSD)
|
|
||||||
set(PKGCONFIG_DIR lib${LIB_SUFFIX}/pkgconfig)
|
|
||||||
if(SFML_OS_FREEBSD OR SFML_OS_OPENBSD)
|
|
||||||
set(PKGCONFIG_DIR libdata/pkgconfig)
|
|
||||||
endif()
|
|
||||||
if(BUILD_SHARED_LIBS)
|
|
||||||
sfml_set_option(SFML_INSTALL_PKGCONFIG_FILES FALSE BOOL "TRUE to automatically install pkg-config files so other projects can find SFML")
|
|
||||||
if(SFML_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}/${PKGCONFIG_DIR}")
|
|
||||||
endforeach()
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
if(SFML_INSTALL_PKGCONFIG_FILES)
|
|
||||||
message(WARNING "No pkg-config files are provided for the static SFML libraries (SFML_INSTALL_PKGCONFIG_FILES will be ignored).")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# enable project folders
|
# enable project folders
|
||||||
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||||
set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER "CMake")
|
set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER "CMake")
|
||||||
@ -306,16 +282,25 @@ if(SFML_BUILD_DOC)
|
|||||||
add_subdirectory(doc)
|
add_subdirectory(doc)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
sfml_set_option(SFML_INSTALL_PKGCONFIG_FILES FALSE BOOL "TRUE to automatically install pkg-config files so other projects can find SFML")
|
# on Linux and BSD-like OS, install pkg-config files by default
|
||||||
|
set(SFML_INSTALL_PKGCONFIG_DEFAULT FALSE)
|
||||||
|
|
||||||
|
if(SFML_OS_LINUX OR SFML_OS_FREEBSD OR SFML_OS_OPENBSD)
|
||||||
|
set(SFML_INSTALL_PKGCONFIG_DEFAULT TRUE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
sfml_set_option(SFML_INSTALL_PKGCONFIG_FILES ${SFML_INSTALL_PKGCONFIG_DEFAULT} BOOL "TRUE to automatically install pkg-config files so other projects can find SFML")
|
||||||
|
|
||||||
|
if(SFML_INSTALL_PKGCONFIG_FILES)
|
||||||
|
sfml_set_option(SFML_PKGCONFIG_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/${SFML_PKGCONFIG_DIR}" PATH "Install directory for SFML's pkg-config .pc files")
|
||||||
|
|
||||||
if(SFML_OS_SUPPORTS_PKGCONFIG OR SFML_INSTALL_PKGCONFIG_FILES)
|
|
||||||
foreach(sfml_module IN ITEMS all system window graphics audio network)
|
foreach(sfml_module IN ITEMS all system window graphics audio network)
|
||||||
CONFIGURE_FILE(
|
CONFIGURE_FILE(
|
||||||
"tools/pkg-config/sfml-${sfml_module}.pc.in"
|
"tools/pkg-config/sfml-${sfml_module}.pc.in"
|
||||||
"tools/pkg-config/sfml-${sfml_module}.pc"
|
"tools/pkg-config/sfml-${sfml_module}.pc"
|
||||||
@ONLY)
|
@ONLY)
|
||||||
INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/tools/pkg-config/sfml-${sfml_module}.pc"
|
INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/tools/pkg-config/sfml-${sfml_module}.pc"
|
||||||
DESTINATION "${CMAKE_INSTALL_PREFIX}/${SFML_OS_PKGCONFIG_DIR}")
|
DESTINATION "${SFML_PKGCONFIG_INSTALL_PREFIX}")
|
||||||
endforeach()
|
endforeach()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -69,17 +69,12 @@ else()
|
|||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# check if OS or package system supports pkg-config
|
# set pkgconfig install directory
|
||||||
# this could be e.g. macports on mac or msys2 on windows etc.
|
# this could be e.g. macports on mac or msys2 on windows etc.
|
||||||
find_package(PkgConfig QUIET)
|
set(SFML_PKGCONFIG_DIR "/lib${LIB_SUFFIX}/pkgconfig")
|
||||||
if(PKG_CONFIG_EXECUTABLE)
|
|
||||||
if(EXISTS "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/pkgconfig")
|
if(SFML_OS_FREEBSD OR SFML_OS_OPENBSD)
|
||||||
set(SFML_OS_SUPPORTS_PKGCONFIG ON)
|
set(SFML_PKGCONFIG_DIR "/libdata/pkgconfig")
|
||||||
set(SFML_OS_PKGCONFIG_DIR "/lib${LIB_SUFFIX}/pkgconfig")
|
|
||||||
elseif(EXISTS "${CMAKE_INSTALL_PREFIX}/libdata/pkgconfig")
|
|
||||||
set(SFML_OS_SUPPORTS_PKGCONFIG ON)
|
|
||||||
set(SFML_OS_PKGCONFIG_DIR "/libdata/pkgconfig")
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# detect the compiler and its version
|
# detect the compiler and its version
|
||||||
|
Loading…
Reference in New Issue
Block a user