mirror of
https://github.com/SFML/SFML.git
synced 2025-01-31 21:55:13 +08:00
Modified FindSFML.cmake for a better handling of debug libraries
Fixed Macros.cmake (the last modification introduced a bug when generating nmake makefiles) git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1573 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
parent
dac1ade7c4
commit
dd63420b52
@ -33,9 +33,12 @@ macro(sfml_static_add_libraries target)
|
|||||||
if(NOT ${lib} MATCHES ".*\\.lib")
|
if(NOT ${lib} MATCHES ".*\\.lib")
|
||||||
set(lib ${lib}.lib)
|
set(lib ${lib}.lib)
|
||||||
endif()
|
endif()
|
||||||
# we add " so that the path will be put into "",
|
if(CMAKE_CONFIGURATION_TYPES) # this condition is true when generator is "Visual Studio solution"
|
||||||
# making possible to have spaces in it
|
# we add " so that the path will be put inside "", making possible to have spaces in it
|
||||||
set(LIBRARIES "${LIBRARIES} "\\;${lib}"\\;")
|
set(LIBRARIES "${LIBRARIES} "\\;${lib}"\\;")
|
||||||
|
else()
|
||||||
|
set(LIBRARIES "${LIBRARIES} ${lib}")
|
||||||
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
set_target_properties(${target} PROPERTIES STATIC_LIBRARY_FLAGS ${LIBRARIES})
|
set_target_properties(${target} PROPERTIES STATIC_LIBRARY_FLAGS ${LIBRARIES})
|
||||||
endif()
|
endif()
|
||||||
|
@ -2,15 +2,13 @@
|
|||||||
#
|
#
|
||||||
# This module defines
|
# This module defines
|
||||||
# SFML_FOUND, if false, do not try to link to SFML
|
# SFML_FOUND, if false, do not try to link to SFML
|
||||||
# SFML_XXX_LIBRARY library corresponding to the XXX component
|
# SFML_XXX_LIBRARY, library corresponding to the XXX component (release)
|
||||||
|
# SFML_XXX_LIBRARY_DEBUG, library corresponding to the XXX component (debug)
|
||||||
# SFML_LIBRARIES, list containing all the libraries corresponding to the requested components
|
# SFML_LIBRARIES, list containing all the libraries corresponding to the requested components
|
||||||
# SFML_INCLUDE_DIR, where to find SFML/Config.hpp
|
# SFML_INCLUDE_DIR, where to find SFML/Config.hpp
|
||||||
#
|
#
|
||||||
# To select a particular debug/release/static/dynamic variant of the SFML libraries,
|
# By default, the dynamic libraries of SFML will be found. To find the static ones instead,
|
||||||
# you must set these variables before calling find_package(SFML ...):
|
# you must set the SFML_STATIC_LIBRARIES variable to TRUE 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
|
# deduce the SFML libraries prefix from the major version number
|
||||||
set(FIND_SFML_LIB_PREFIX "sfml-")
|
set(FIND_SFML_LIB_PREFIX "sfml-")
|
||||||
@ -23,9 +21,6 @@ set(FIND_SFML_LIB_SUFFIX "")
|
|||||||
if(SFML_STATIC_LIBRARIES)
|
if(SFML_STATIC_LIBRARIES)
|
||||||
set(FIND_SFML_LIB_SUFFIX "${FIND_SFML_LIB_SUFFIX}-s")
|
set(FIND_SFML_LIB_SUFFIX "${FIND_SFML_LIB_SUFFIX}-s")
|
||||||
endif()
|
endif()
|
||||||
if(SFML_DEBUG_LIBRARIES)
|
|
||||||
set(FIND_SFML_LIB_SUFFIX "${FIND_SFML_LIB_SUFFIX}-d")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# find the SFML include directory
|
# find the SFML include directory
|
||||||
find_path(SFML_INCLUDE_DIR SFML/Config.hpp
|
find_path(SFML_INCLUDE_DIR SFML/Config.hpp
|
||||||
@ -42,25 +37,32 @@ find_path(SFML_INCLUDE_DIR SFML/Config.hpp
|
|||||||
${SFMLDIR})
|
${SFMLDIR})
|
||||||
|
|
||||||
# find the requested components
|
# find the requested components
|
||||||
|
set(FIND_SFML_LIB_PATHS ~/Library/Frameworks
|
||||||
|
/Library/Frameworks
|
||||||
|
/usr/local
|
||||||
|
/usr
|
||||||
|
/sw
|
||||||
|
/opt/local
|
||||||
|
/opt/csw
|
||||||
|
/opt
|
||||||
|
${SFMLDIR})
|
||||||
foreach(FIND_SFML_COMPONENT ${SFML_FIND_COMPONENTS})
|
foreach(FIND_SFML_COMPONENT ${SFML_FIND_COMPONENTS})
|
||||||
string(TOLOWER ${FIND_SFML_COMPONENT} FIND_SFML_COMPONENT_LOWER)
|
string(TOLOWER ${FIND_SFML_COMPONENT} FIND_SFML_COMPONENT_LOWER)
|
||||||
string(TOUPPER ${FIND_SFML_COMPONENT} FIND_SFML_COMPONENT_UPPER)
|
string(TOUPPER ${FIND_SFML_COMPONENT} FIND_SFML_COMPONENT_UPPER)
|
||||||
set(FIND_SFML_COMPONENT_VAR SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY)
|
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})
|
set(FIND_SFML_COMPONENT_NAME ${FIND_SFML_LIB_PREFIX}${FIND_SFML_COMPONENT_LOWER}${FIND_SFML_LIB_SUFFIX})
|
||||||
|
|
||||||
|
# release library
|
||||||
find_library(${FIND_SFML_COMPONENT_VAR}
|
find_library(${FIND_SFML_COMPONENT_VAR}
|
||||||
NAMES ${FIND_SFML_COMPONENT_NAME}
|
NAMES ${FIND_SFML_COMPONENT_NAME}
|
||||||
PATH_SUFFIXES lib64 lib
|
PATH_SUFFIXES lib64 lib
|
||||||
PATHS
|
PATHS ${FIND_SFML_LIB_PATHS})
|
||||||
~/Library/Frameworks
|
|
||||||
/Library/Frameworks
|
# debug library
|
||||||
/usr/local
|
find_library(${FIND_SFML_COMPONENT_VAR}_DEBUG
|
||||||
/usr
|
NAMES ${FIND_SFML_COMPONENT_NAME}-d
|
||||||
/sw
|
PATH_SUFFIXES lib64 lib
|
||||||
/opt/local
|
PATHS ${FIND_SFML_LIB_PATHS})
|
||||||
/opt/csw
|
|
||||||
/opt
|
|
||||||
${SFMLDIR})
|
|
||||||
|
|
||||||
set(SFML_LIBRARIES_NAMES ${SFML_LIBRARIES_NAMES} ${FIND_SFML_COMPONENT_VAR})
|
set(SFML_LIBRARIES_NAMES ${SFML_LIBRARIES_NAMES} ${FIND_SFML_COMPONENT_VAR})
|
||||||
set(SFML_LIBRARIES ${SFML_LIBRARIES} ${${FIND_SFML_COMPONENT_VAR}})
|
set(SFML_LIBRARIES ${SFML_LIBRARIES} ${${FIND_SFML_COMPONENT_VAR}})
|
||||||
|
Loading…
Reference in New Issue
Block a user