@@ -115,25 +115,22 @@ set_property(TARGET "${CMAKE_PROJECT_NAME}" PROPERTY CXX_STANDARD 17)
|
|||||||
#========================================================================================
|
#========================================================================================
|
||||||
# CHANGE RESOURCES DEFINITION
|
# CHANGE RESOURCES DEFINITION
|
||||||
#========================================================================================
|
#========================================================================================
|
||||||
# By default, when in debug mode. Resources are pulled from the folder in the root of
|
# You will change which line is commented depending
|
||||||
# the project. This is statically mapped. The value of RESOURCES_PATH become
|
# on if the compiled binary is for development or
|
||||||
# /home/user1/Projects/Project. Thats not very usefull for shipping the application as
|
# production.
|
||||||
# the user is unlikely to have your same folder structure.
|
#
|
||||||
|
# Uncomment the line below when in development, this uses the resources folder
|
||||||
|
# in the CMake project for the RESOURCES_PATH definition
|
||||||
|
target_compile_definitions("${CMAKE_PROJECT_NAME}" PUBLIC RESOURCES_PATH="${CMAKE_CURRENT_SOURCE_DIR}/resources/")
|
||||||
|
#
|
||||||
|
# Uncomment the line below when in production, this uses a folder in the same working
|
||||||
|
# directory of the binary called "resources". Effectively RESOURCES_PATH
|
||||||
|
# becomes ./resources/. You would copy the resources folder of the cmake project
|
||||||
|
# and ship it will the compiled binary
|
||||||
|
#target_compile_definitions("${CMAKE_PROJECT_NAME}" PUBLIC RESOURCES_PATH="./resources/")
|
||||||
#
|
#
|
||||||
# So in release mode, the value of RESOURCES_PATH become ./resources/ so it will use the
|
|
||||||
# resources folder in the same folder as the executable
|
|
||||||
target_compile_definitions("${CMAKE_PROJECT_NAME}" PUBLIC
|
|
||||||
RESOURCES_PATH="$<$<CONFIG:Debug>:${CMAKE_CURRENT_SOURCE_DIR}/resources/>$<$<CONFIG:Release>:./resources/>"
|
|
||||||
)
|
|
||||||
|
|
||||||
# This copis the resources folder to the build location when in release mode
|
|
||||||
add_custom_command(TARGET "${CMAKE_PROJECT_NAME}" POST_BUILD
|
|
||||||
COMMAND $<$<CONFIG:Release>:${CMAKE_COMMAND}>
|
|
||||||
$<$<CONFIG:Release>:-E>
|
|
||||||
$<$<CONFIG:Release>:copy_directory>
|
|
||||||
$<$<CONFIG:Release>:"${CMAKE_CURRENT_SOURCE_DIR}/resources">
|
|
||||||
$<$<CONFIG:Release>:"$<TARGET_FILE_DIR:${CMAKE_PROJECT_NAME}>/resources">
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
# Add our sources
|
# Add our sources
|
||||||
|
|||||||
Reference in New Issue
Block a user