mirror of
https://github.com/SFML/SFML.git
synced 2024-11-28 22:31:09 +08:00
Added a FindSFML.cmake file for CMake
git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1571 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
parent
19cb364afe
commit
076456aa91
@ -57,6 +57,8 @@ install(DIRECTORY include
|
|||||||
DESTINATION .
|
DESTINATION .
|
||||||
COMPONENT devel
|
COMPONENT devel
|
||||||
PATTERN ".svn" EXCLUDE)
|
PATTERN ".svn" EXCLUDE)
|
||||||
|
install(FILES cmake/Modules/FindSFML.cmake
|
||||||
|
DESTINATION ${INSTALL_MISC_DIR}/cmake/Modules)
|
||||||
install(FILES license.txt DESTINATION ${INSTALL_MISC_DIR})
|
install(FILES license.txt DESTINATION ${INSTALL_MISC_DIR})
|
||||||
if(WINDOWS)
|
if(WINDOWS)
|
||||||
install(FILES extlibs/bin/libsndfile-1.dll DESTINATION bin)
|
install(FILES extlibs/bin/libsndfile-1.dll DESTINATION bin)
|
||||||
|
72
cmake/Modules/FindSFML.cmake
Normal file
72
cmake/Modules/FindSFML.cmake
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
# Locate the SFML library
|
||||||
|
#
|
||||||
|
# This module defines
|
||||||
|
# SFML_FOUND, if false, do not try to link to SFML
|
||||||
|
# SFML_XXX_LIBRARY library corresponding to the XXX component
|
||||||
|
# SFML_LIBRARIES, list containing all the libraries corresponding to the requested components
|
||||||
|
# SFML_INCLUDE_DIR, where to find SFML/Config.hpp
|
||||||
|
#
|
||||||
|
# To select a particular debug/release/static/dynamic variant of the SFML libraries,
|
||||||
|
# you must set these variables before calling find_package(SFML ...):
|
||||||
|
# - SFML_DEBUG_LIBRARIES: 1 for debug, 0 for release
|
||||||
|
# - SFML_STATIC_LIBRARIES: 1 for static, 0 for dynamic
|
||||||
|
# If not specified, both are set to 0 (release dynamic)
|
||||||
|
|
||||||
|
# deduce the SFML libraries prefix from the major version number
|
||||||
|
set(FIND_SFML_LIB_PREFIX "sfml-")
|
||||||
|
if(${SFML_FIND_VERSION_MAJOR} GREATER 1)
|
||||||
|
set(FIND_SFML_LIB_PREFIX "sfml${SFML_FIND_VERSION_MAJOR}-")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# deduce the libraries suffix from the options
|
||||||
|
set(FIND_SFML_LIB_SUFFIX "")
|
||||||
|
if(SFML_STATIC_LIBRARIES)
|
||||||
|
set(FIND_SFML_LIB_SUFFIX "${FIND_SFML_LIB_SUFFIX}-s")
|
||||||
|
endif()
|
||||||
|
if(SFML_DEBUG_LIBRARIES)
|
||||||
|
set(FIND_SFML_LIB_SUFFIX "${FIND_SFML_LIB_SUFFIX}-d")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# find the SFML include directory
|
||||||
|
find_path(SFML_INCLUDE_DIR SFML/Config.hpp
|
||||||
|
PATH_SUFFIXES include
|
||||||
|
PATHS
|
||||||
|
~/Library/Frameworks
|
||||||
|
/Library/Frameworks
|
||||||
|
/usr/local/
|
||||||
|
/usr/
|
||||||
|
/sw # Fink
|
||||||
|
/opt/local/ # DarwinPorts
|
||||||
|
/opt/csw/ # Blastwave
|
||||||
|
/opt/
|
||||||
|
${SFMLDIR})
|
||||||
|
|
||||||
|
# find the requested components
|
||||||
|
foreach(FIND_SFML_COMPONENT ${SFML_FIND_COMPONENTS})
|
||||||
|
string(TOLOWER ${FIND_SFML_COMPONENT} FIND_SFML_COMPONENT_LOWER)
|
||||||
|
string(TOUPPER ${FIND_SFML_COMPONENT} FIND_SFML_COMPONENT_UPPER)
|
||||||
|
set(FIND_SFML_COMPONENT_VAR SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY)
|
||||||
|
set(FIND_SFML_COMPONENT_NAME ${FIND_SFML_LIB_PREFIX}${FIND_SFML_COMPONENT_LOWER}${FIND_SFML_LIB_SUFFIX})
|
||||||
|
|
||||||
|
find_library(${FIND_SFML_COMPONENT_VAR}
|
||||||
|
NAMES ${FIND_SFML_COMPONENT_NAME}
|
||||||
|
PATH_SUFFIXES lib64 lib
|
||||||
|
PATHS
|
||||||
|
~/Library/Frameworks
|
||||||
|
/Library/Frameworks
|
||||||
|
/usr/local
|
||||||
|
/usr
|
||||||
|
/sw
|
||||||
|
/opt/local
|
||||||
|
/opt/csw
|
||||||
|
/opt
|
||||||
|
${SFMLDIR})
|
||||||
|
|
||||||
|
set(SFML_LIBRARIES_NAMES ${SFML_LIBRARIES_NAMES} ${FIND_SFML_COMPONENT_VAR})
|
||||||
|
set(SFML_LIBRARIES ${SFML_LIBRARIES} ${${FIND_SFML_COMPONENT_VAR}})
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
# handle the QUIETLY and REQUIRED arguments and set SFML_FOUND to TRUE if all listed variables are TRUE
|
||||||
|
INCLUDE(FindPackageHandleStandardArgs)
|
||||||
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SFML DEFAULT_MSG SFML_INCLUDE_DIR ${SFML_LIBRARIES_NAMES})
|
||||||
|
MARK_AS_ADVANCED(SFML_INCLUDE_DIR ${SFML_LIBRARIES_NAMES})
|
Loading…
Reference in New Issue
Block a user