update install command

This commit is contained in:
Kevin Yue
2021-09-13 14:31:04 +08:00
parent 405e84e40c
commit 0eb9cce8bb
2 changed files with 13 additions and 2 deletions

View File

@@ -1,13 +1,22 @@
include(cmake/CPM.cmake)
function(add_3rdparty)
cmake_parse_arguments(add_3rdparty_args "" "NAME" "" ${ARGN})
cmake_parse_arguments(add_3rdparty_args "EXCLUDE_FROM_ALL" "NAME" "" ${ARGN})
set(NAME ${add_3rdparty_args_NAME})
if(EXISTS "${CMAKE_SOURCE_DIR}/3rdparty/${NAME}/CMakeLists.txt")
message(STATUS "Found third party locally for ${NAME}")
add_subdirectory("${CMAKE_SOURCE_DIR}/3rdparty/${NAME}")
if(${add_3rdparty_args_EXCLUDE_FROM_ALL})
set(addSubdirectoryExtraArgs EXCLUDE_FROM_ALL)
else()
set(addSubdirectoryExtraArgs "")
endif()
add_subdirectory(
"${CMAKE_SOURCE_DIR}/3rdparty/${NAME}"
${addSubdirectoryExtraArgs}
)
return()
endif()
message(STATUS "Using CPM to download ${NAME}")