mirror of https://gitee.com/cxasm/notepad--.git
cmake-plugin: 为引用在线构建的开关设置 online 别名
This commit is contained in:
parent
8c68f8b8dc
commit
1770af797d
|
@ -40,7 +40,7 @@ if(USE_NOTEPAD_PLUGIN)
|
||||||
# 一个使用引用构建的插件
|
# 一个使用引用构建的插件
|
||||||
# include(path/to/plugin.cmake)
|
# include(path/to/plugin.cmake)
|
||||||
|
|
||||||
# # 一个简单的 plantuml 预览插件
|
# 一个 plantuml 预览插件(使用 with_git 引用的在线构建)
|
||||||
# add_framework_plugin_with_git(https://gitee.com/ndd-community/notepad--plugin.plantuml-preview --branch=cmake-plugins-dev)
|
# add_framework_plugin_with_git(https://gitee.com/ndd-community/notepad--plugin.plantuml-preview --branch=cmake-plugins-dev)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -5,10 +5,16 @@
|
||||||
# 基于提供的包含源代码文件的的路径,或指定的要构建的源代码
|
# 基于提供的包含源代码文件的的路径,或指定的要构建的源代码
|
||||||
macro(add_framework_plugin _target)
|
macro(add_framework_plugin _target)
|
||||||
|
|
||||||
option(${_target}_ENABLE "是否确认构建 ${_target} 插件" OFF)
|
set(${_target}_ALIAS ${_target})
|
||||||
|
if(WITH_GIT)
|
||||||
|
set(${_target}_ALIAS online-${_target})
|
||||||
|
unset(WITH_GIT)
|
||||||
|
endif(WITH_GIT)
|
||||||
|
|
||||||
if(${${_target}_ENABLE})
|
option(${${_target}_ALIAS}_ENABLE "是否确认构建 ${_target} 插件" OFF)
|
||||||
|
|
||||||
|
if(${${${_target}_ALIAS}_ENABLE})
|
||||||
|
set(${_target}_ENABLE ON)
|
||||||
set(${_target}_ARGN ${ARGN})
|
set(${_target}_ARGN ${ARGN})
|
||||||
# set(${_target}_DIR_OR_SOURCES)
|
# set(${_target}_DIR_OR_SOURCES)
|
||||||
foreach(arg IN LISTS ${_target}_ARGN)
|
foreach(arg IN LISTS ${_target}_ARGN)
|
||||||
|
@ -84,7 +90,7 @@ if(${${_target}_ENABLE})
|
||||||
">>>>>>>>>>>>>>>>>>>>>>>>>>> ${_target} CMake Debug <<<<<<<<<<<<<<<<<<<<<<<<<<<"
|
">>>>>>>>>>>>>>>>>>>>>>>>>>> ${_target} CMake Debug <<<<<<<<<<<<<<<<<<<<<<<<<<<"
|
||||||
)
|
)
|
||||||
|
|
||||||
endif(${${_target}_ENABLE})
|
endif(${${${_target}_ALIAS}_ENABLE})
|
||||||
|
|
||||||
endmacro(add_framework_plugin _target)
|
endmacro(add_framework_plugin _target)
|
||||||
|
|
||||||
|
@ -135,6 +141,7 @@ macro(add_framework_plugin_with_git GIT_REPO_URL)
|
||||||
# 6. 处理加入构建,如果这个仓库里有 plugin.cmake 的话
|
# 6. 处理加入构建,如果这个仓库里有 plugin.cmake 的话
|
||||||
if(EXISTS ${CMAKE_BINARY_DIR}/${URL_USER}_${URL_REPO}_git/plugin.cmake)
|
if(EXISTS ${CMAKE_BINARY_DIR}/${URL_USER}_${URL_REPO}_git/plugin.cmake)
|
||||||
message("-- [GIT_PLUGIN] Found new plugin with git: ${CMAKE_BINARY_DIR}/${URL_USER}_${URL_REPO}_git/plugin.cmake")
|
message("-- [GIT_PLUGIN] Found new plugin with git: ${CMAKE_BINARY_DIR}/${URL_USER}_${URL_REPO}_git/plugin.cmake")
|
||||||
|
set(WITH_GIT ON)
|
||||||
include(${CMAKE_BINARY_DIR}/${URL_USER}_${URL_REPO}_git/plugin.cmake)
|
include(${CMAKE_BINARY_DIR}/${URL_USER}_${URL_REPO}_git/plugin.cmake)
|
||||||
else()
|
else()
|
||||||
return()
|
return()
|
||||||
|
|
Loading…
Reference in New Issue