mirror of
https://github.com/SFML/SFML.git
synced 2025-01-19 07:45: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")
|
||||
set(lib ${lib}.lib)
|
||||
endif()
|
||||
# we add " so that the path will be put into "",
|
||||
# making possible to have spaces in it
|
||||
if(CMAKE_CONFIGURATION_TYPES) # this condition is true when generator is "Visual Studio solution"
|
||||
# we add " so that the path will be put inside "", making possible to have spaces in it
|
||||
set(LIBRARIES "${LIBRARIES} "\\;${lib}"\\;")
|
||||
else()
|
||||
set(LIBRARIES "${LIBRARIES} ${lib}")
|
||||
endif()
|
||||
endforeach()
|
||||
set_target_properties(${target} PROPERTIES STATIC_LIBRARY_FLAGS ${LIBRARIES})
|
||||
endif()
|
||||
|
@ -2,15 +2,13 @@
|
||||
#
|
||||
# This module defines
|
||||
# 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_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)
|
||||
# By default, the dynamic libraries of SFML will be found. To find the static ones instead,
|
||||
# you must set the SFML_STATIC_LIBRARIES variable to TRUE before calling find_package(SFML ...).
|
||||
|
||||
# deduce the SFML libraries prefix from the major version number
|
||||
set(FIND_SFML_LIB_PREFIX "sfml-")
|
||||
@ -23,9 +21,6 @@ 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
|
||||
@ -42,17 +37,7 @@ find_path(SFML_INCLUDE_DIR SFML/Config.hpp
|
||||
${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
|
||||
set(FIND_SFML_LIB_PATHS ~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/usr/local
|
||||
/usr
|
||||
@ -61,6 +46,23 @@ foreach(FIND_SFML_COMPONENT ${SFML_FIND_COMPONENTS})
|
||||
/opt/csw
|
||||
/opt
|
||||
${SFMLDIR})
|
||||
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})
|
||||
|
||||
# release library
|
||||
find_library(${FIND_SFML_COMPONENT_VAR}
|
||||
NAMES ${FIND_SFML_COMPONENT_NAME}
|
||||
PATH_SUFFIXES lib64 lib
|
||||
PATHS ${FIND_SFML_LIB_PATHS})
|
||||
|
||||
# debug library
|
||||
find_library(${FIND_SFML_COMPONENT_VAR}_DEBUG
|
||||
NAMES ${FIND_SFML_COMPONENT_NAME}-d
|
||||
PATH_SUFFIXES lib64 lib
|
||||
PATHS ${FIND_SFML_LIB_PATHS})
|
||||
|
||||
set(SFML_LIBRARIES_NAMES ${SFML_LIBRARIES_NAMES} ${FIND_SFML_COMPONENT_VAR})
|
||||
set(SFML_LIBRARIES ${SFML_LIBRARIES} ${${FIND_SFML_COMPONENT_VAR}})
|
||||
|
Loading…
Reference in New Issue
Block a user