-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
7 changed files
with
101 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
set(_CPM_Dir "${CMAKE_CURRENT_LIST_DIR}") | ||
|
||
include(CMakeParseArguments) | ||
include(${_CPM_Dir}/DownloadProject.cmake) | ||
|
||
function(CPMHasPackage) | ||
|
||
endfunction() | ||
|
||
function(CPMAddPackage) | ||
set(options QUIET) | ||
|
||
set(oneValueArgs | ||
NAME | ||
GIT_REPOSITORY | ||
VERSION | ||
GIT_TAG | ||
BINARY_DIR | ||
) | ||
|
||
set(multiValueArgs "") | ||
|
||
cmake_parse_arguments(CPM_ARGS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) | ||
|
||
if (NOT CPM_PACKAGES) | ||
set(CPM_PACKAGES "") | ||
endif() | ||
|
||
if (NOT CPM_ARGS_BINARY_DIR) | ||
set(CPM_ARGS_BINARY_DIR ${CMAKE_BINARY_DIR}/CPM-projects/${CPM_ARGS_NAME}) | ||
endif() | ||
|
||
if (NOT CPM_PROJECT_DIR) | ||
set(CPM_PROJECT_DIR "${CPM_ARGS_BINARY_DIR}") | ||
endif() | ||
|
||
if (NOT CPM_ARGS_GIT_TAG) | ||
set(CPM_ARGS_GIT_TAG v${CPM_ARGS_VERSION}) | ||
endif() | ||
|
||
SET(CPM_TARGET_CMAKE_FILE "${CPM_PROJECT_DIR}") | ||
|
||
if (${CPM_ARGS_NAME} IN_LIST CPM_PACKAGES) | ||
message(STATUS "CPM: package ${CPM_ARGS_NAME} already added") | ||
else() | ||
message(STATUS "CPM: adding package ${CPM_ARGS_NAME}@${CPM_ARGS_VERSION}") | ||
# update package data | ||
LIST(APPEND CPM_PACKAGES ${CPM_ARGS_NAME}) | ||
# save package data | ||
set(CPM_PACKAGES "${CPM_PACKAGES}" CACHE INTERNAL "CPM Packages") | ||
|
||
configure_file( | ||
"${_CPM_Dir}/CPMProject.CMakeLists.cmake.in" | ||
"${CPM_TARGET_CMAKE_FILE}/CMakeLists.txt" | ||
@ONLY | ||
) | ||
endif() | ||
|
||
if (NOT TARGET ${CPM_ARGS_NAME}) | ||
add_subdirectory(${CPM_TARGET_CMAKE_FILE} ${CPM_ARGS_BINARY_DIR}) | ||
endif() | ||
|
||
endfunction() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
cmake_minimum_required(VERSION 3.5 FATAL_ERROR) | ||
|
||
if(TARGET @CPM_ARGS_NAME@) | ||
return() | ||
endif() | ||
|
||
find_package(@CPM_ARGS_NAME@ @CPM_ARGS_VERSION@ QUIET) | ||
|
||
if(${PACKAGE_FOUND}) | ||
set_target_properties(@CPM_ARGS_NAME@ | ||
PROPERTIES | ||
IMPORTED_GLOBAL True | ||
) | ||
else() | ||
|
||
download_project( | ||
PROJ @CPM_ARGS_NAME@ | ||
GIT_REPOSITORY @CPM_ARGS_GIT_REPOSITORY@ | ||
GIT_TAG @CPM_ARGS_GIT_TAG@ | ||
UPDATE_DISCONNECTED 1 | ||
GIT_SHALLOW 1 | ||
PREFIX @CPM_ARGS_BINARY_DIR@/dl | ||
QUIET | ||
) | ||
|
||
add_subdirectory(${@CPM_ARGS_NAME@_SOURCE_DIR} ${@CPM_ARGS_NAME@_BINARY_DIR}) | ||
endif() |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.