mirror of
https://github.com/SFML/SFML.git
synced 2024-11-25 04:41:05 +08:00
Replace INSTALL_RESOURCES_DIR option of sfml_add_example() command with RESOURCES_DIR
This commit is contained in:
parent
777ec2c04d
commit
ce7ced5488
@ -153,11 +153,11 @@ endmacro()
|
|||||||
# SOURCES ftp.cpp ...
|
# SOURCES ftp.cpp ...
|
||||||
# BUNDLE_RESOURCES MainMenu.nib ... # Files to be added in target but not installed next to the executable
|
# BUNDLE_RESOURCES MainMenu.nib ... # Files to be added in target but not installed next to the executable
|
||||||
# DEPENDS sfml-network sfml-system
|
# DEPENDS sfml-network sfml-system
|
||||||
# [INSTALL_RESOURCES_DIR]) # In addition to the sources, also install the "resources" directory
|
# RESOURCES_DIR resources) # A directory to install next to the executable and sources
|
||||||
macro(sfml_add_example target)
|
macro(sfml_add_example target)
|
||||||
|
|
||||||
# parse the arguments
|
# parse the arguments
|
||||||
cmake_parse_arguments(THIS "GUI_APP;INSTALL_RESOURCES_DIR" "" "SOURCES;BUNDLE_RESOURCES;DEPENDS" ${ARGN})
|
cmake_parse_arguments(THIS "GUI_APP" "RESOURCES_DIR" "SOURCES;BUNDLE_RESOURCES;DEPENDS" ${ARGN})
|
||||||
|
|
||||||
# set a source group for the source files
|
# set a source group for the source files
|
||||||
source_group("" FILES ${THIS_SOURCES})
|
source_group("" FILES ${THIS_SOURCES})
|
||||||
@ -206,14 +206,16 @@ macro(sfml_add_example target)
|
|||||||
DESTINATION ${INSTALL_MISC_DIR}/examples/${target}
|
DESTINATION ${INSTALL_MISC_DIR}/examples/${target}
|
||||||
COMPONENT examples)
|
COMPONENT examples)
|
||||||
|
|
||||||
if (THIS_INSTALL_RESOURCES_DIR)
|
if (THIS_RESOURCES_DIR)
|
||||||
# install the example's resources as well
|
# install the example's resources as well
|
||||||
set(EXAMPLE_RESOURCES "${CMAKE_SOURCE_DIR}/examples/${target}/resources")
|
get_filename_component(THIS_RESOURCES_DIR "${THIS_RESOURCES_DIR}" ABSOLUTE)
|
||||||
if(EXISTS ${EXAMPLE_RESOURCES})
|
|
||||||
install(DIRECTORY ${EXAMPLE_RESOURCES}
|
if(NOT EXISTS "${THIS_RESOURCES_DIR}")
|
||||||
DESTINATION ${INSTALL_MISC_DIR}/examples/${target}
|
message(FATAL_ERROR "Given resources directory to install does not exist: ${THIS_RESOURCES_DIR}")
|
||||||
COMPONENT examples)
|
|
||||||
endif()
|
endif()
|
||||||
|
install(DIRECTORY ${THIS_RESOURCES_DIR}
|
||||||
|
DESTINATION ${INSTALL_MISC_DIR}/examples/${target}
|
||||||
|
COMPONENT examples)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
endmacro()
|
endmacro()
|
||||||
|
@ -13,4 +13,4 @@ set(ADDITIONAL_LIBRARIES ${OPENGL_LIBRARIES})
|
|||||||
sfml_add_example(opengl GUI_APP
|
sfml_add_example(opengl GUI_APP
|
||||||
SOURCES ${SRC}
|
SOURCES ${SRC}
|
||||||
DEPENDS sfml-graphics sfml-window sfml-system ${ADDITIONAL_LIBRARIES}
|
DEPENDS sfml-graphics sfml-window sfml-system ${ADDITIONAL_LIBRARIES}
|
||||||
INSTALL_RESOURCES_DIR)
|
RESOURCES_DIR resources)
|
||||||
|
@ -8,4 +8,4 @@ set(SRC ${SRCROOT}/Pong.cpp)
|
|||||||
sfml_add_example(pong GUI_APP
|
sfml_add_example(pong GUI_APP
|
||||||
SOURCES ${SRC}
|
SOURCES ${SRC}
|
||||||
DEPENDS sfml-audio sfml-graphics sfml-window sfml-system
|
DEPENDS sfml-audio sfml-graphics sfml-window sfml-system
|
||||||
INSTALL_RESOURCES_DIR)
|
RESOURCES_DIR resources)
|
||||||
|
@ -10,4 +10,4 @@ set(SRC
|
|||||||
sfml_add_example(shader GUI_APP
|
sfml_add_example(shader GUI_APP
|
||||||
SOURCES ${SRC}
|
SOURCES ${SRC}
|
||||||
DEPENDS sfml-graphics sfml-window sfml-system
|
DEPENDS sfml-graphics sfml-window sfml-system
|
||||||
INSTALL_RESOURCES_DIR)
|
RESOURCES_DIR resources)
|
||||||
|
@ -8,4 +8,4 @@ set(SRC ${SRCROOT}/Sound.cpp)
|
|||||||
sfml_add_example(sound
|
sfml_add_example(sound
|
||||||
SOURCES ${SRC}
|
SOURCES ${SRC}
|
||||||
DEPENDS sfml-audio sfml-system
|
DEPENDS sfml-audio sfml-system
|
||||||
INSTALL_RESOURCES_DIR)
|
RESOURCES_DIR resources)
|
||||||
|
@ -8,4 +8,4 @@ set(SRC ${SRCROOT}/Win32.cpp)
|
|||||||
sfml_add_example(win32 GUI_APP
|
sfml_add_example(win32 GUI_APP
|
||||||
SOURCES ${SRC}
|
SOURCES ${SRC}
|
||||||
DEPENDS sfml-graphics sfml-window sfml-system
|
DEPENDS sfml-graphics sfml-window sfml-system
|
||||||
INSTALL_RESOURCES_DIR)
|
RESOURCES_DIR resources)
|
||||||
|
Loading…
Reference in New Issue
Block a user