glerminal/examples/CMakeLists.txt

40 lines
1005 B
CMake
Raw Normal View History

2024-05-09 19:42:12 +00:00
cmake_minimum_required(VERSION 3.28)
set(CMAKE_FOLDER examples)
2024-05-20 02:46:56 +00:00
file(GLOB_RECURSE
EXAMPLE_RESOURCES
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
CONFIGURE_DEPENDS
2024-05-09 19:42:12 +00:00
2024-05-20 02:46:56 +00:00
${CMAKE_CURRENT_SOURCE_DIR}/resources/**.png
)
2024-05-20 02:46:56 +00:00
foreach(RESOURCE_FILE ${EXAMPLE_RESOURCES})
add_custom_command(
2024-05-29 22:53:47 +00:00
OUTPUT
2024-05-20 02:46:56 +00:00
${CMAKE_CURRENT_BINARY_DIR}/${RESOURCE_FILE}
2024-05-29 22:53:47 +00:00
COMMAND
${CMAKE_COMMAND} -E copy
${CMAKE_CURRENT_SOURCE_DIR}/${RESOURCE_FILE}
${CMAKE_CURRENT_BINARY_DIR}/${RESOURCE_FILE}
2024-05-20 02:46:56 +00:00
DEPENDS
${CMAKE_CURRENT_SOURCE_DIR}/${RESOURCE_FILE}
)
endforeach()
file(GLOB_RECURSE
EXAMPLE_SOURCES
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
CONFIGURE_DEPENDS
${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
)
2024-05-20 02:46:56 +00:00
list(TRANSFORM EXAMPLE_RESOURCES PREPEND ${CMAKE_CURRENT_BINARY_DIR}/)
foreach(SOURCE_FILE ${EXAMPLE_SOURCES})
get_filename_component(SOURCE_FILENAME ${SOURCE_FILE} NAME_WLE)
add_executable(${SOURCE_FILENAME} WIN32 ${SOURCE_FILE} ${EXAMPLE_RESOURCES})
2024-05-29 22:53:47 +00:00
target_link_libraries(${SOURCE_FILENAME} PRIVATE glerminallib)
2024-05-20 02:46:56 +00:00
endforeach()