update cmake for CPM.cmake
This commit is contained in:
parent
9f616e196c
commit
bf0c7ab8ef
6 changed files with 2636 additions and 26 deletions
|
@ -9,11 +9,23 @@ set(CMAKE_CXX_STANDARD 17)
|
|||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
|
||||
include(../cmake/utils.cmake)
|
||||
include(cmake/utils.cmake)
|
||||
|
||||
add_library(alyson)
|
||||
target_include_directories(alyson PUBLIC includes)
|
||||
|
||||
CPMAddPackage(
|
||||
NAME raylib
|
||||
GITHUB_REPOSITORY raysan5/raylib
|
||||
GIT_TAG 5.5
|
||||
)
|
||||
|
||||
CPMAddPackage(
|
||||
NAME flecs
|
||||
GITHUB_REPOSITORY SanderMertens/flecs
|
||||
GIT_TAG v4.0.4
|
||||
)
|
||||
|
||||
target_link_libraries(alyson PUBLIC raylib)
|
||||
target_link_libraries(alyson PUBLIC flecs::flecs_static)
|
||||
|
||||
|
|
1289
alyson/cmake/CPM.cmake
Normal file
1289
alyson/cmake/CPM.cmake
Normal file
File diff suppressed because it is too large
Load diff
33
alyson/cmake/utils.cmake
Normal file
33
alyson/cmake/utils.cmake
Normal file
|
@ -0,0 +1,33 @@
|
|||
|
||||
function(put_targets_into_folder)
|
||||
set(oneValueArgs FOLDER)
|
||||
set(multiValueArgs TARGETS)
|
||||
cmake_parse_arguments(ARGS "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
|
||||
foreach(target ${ARGS_TARGETS})
|
||||
# Check if target exists
|
||||
if (NOT TARGET ${target})
|
||||
message(FATAL_ERROR "${target} target not found")
|
||||
endif()
|
||||
|
||||
# Get the actual target (if it is aliased)
|
||||
get_target_property(actual_target ${target} ALIASED_TARGET)
|
||||
if (NOT actual_target)
|
||||
set(actual_target ${target})
|
||||
endif()
|
||||
|
||||
# Set the folder property for the target
|
||||
set_target_properties(${actual_target} PROPERTIES FOLDER ${ARGS_FOLDER})
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
|
||||
function(find_files var_name path)
|
||||
set(sources)
|
||||
foreach(ext ${ARGN})
|
||||
file(GLOB_RECURSE files "${path}/*.${ext}")
|
||||
list(APPEND sources ${files})
|
||||
endforeach()
|
||||
set(${var_name} ${${var_name}} ${sources} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue