Skip to content

Commit

Permalink
Reorder functions for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
greenc-FNAL committed Nov 13, 2023
1 parent bcb861d commit a32ba78
Showing 1 changed file with 44 additions and 44 deletions.
88 changes: 44 additions & 44 deletions Modules/BasicPlugin.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,50 @@ Need ${BASE}(), ${BASE}_plugin() or dependencies in \${${BASE}_LIBRARIES}, or us
endif()
endmacro()

function(cet_collect_plugin_builders DEST_SUBDIR)
cmake_parse_arguments(PARSE_ARGV 1 _ccpb "NOP" "" "LIST")
list(POP_FRONT _ccpb_UNPARSED_ARGUMENTS NAME_WE)
if ("${NAME_WE}" STREQUAL "")
if (NOT "${_ccpb_LIST}" STREQUAL "")
message(FATAL_ERROR "wrapper filepath required when LIST is specified")
endif()
set(NAME_WE ${CETMODULES_CURRENT_PROJECT_NAME}PluginBuilders)
endif()
if ("${_ccpb_LIST}" STREQUAL "")
set(_ccpb_LIST "${CETMODULES_PLUGIN_BUILDERS_PROJECT_${CETMODULES_CURRENT_PROJECT_NAME}}")
unset(CETMODULES_PLUGIN_BUILDERS_PROJECT_${CETMODULES_CURRENT_PROJECT_NAME} PARENT_SCOPE)
unset(CETMODULES_PLUGIN_BUILDERS_PROJECT_${CETMODULES_CURRENT_PROJECT_NAME} CACHE)
endif()
list(SORT _ccpb_LIST)
list(TRANSFORM _ccpb_LIST
REPLACE "^(.+)$" "include(\\1)" OUTPUT_VARIABLE _ccpb_includes)
list(JOIN _ccpb_includes "\n" _ccpb_includes_content)
file(WRITE
"${${CETMODULES_CURRENT_PROJECT_NAME}_BINARY_DIR}/${DEST_SUBDIR}/${NAME_WE}.cmake"
"\
include_guard()
${_ccpb_includes_content}
\
")
install(FILES
"${${CETMODULES_CURRENT_PROJECT_NAME}_BINARY_DIR}/${DEST_SUBDIR}/${NAME_WE}.cmake"
DESTINATION "${DEST_SUBDIR}")
endfunction()

function(cet_make_plugin_builder TYPE BASE DEST_SUBDIR)
cet_write_plugin_builder(${ARGV} INSTALL_BUILDER)
if (NOT DEFINED
CACHE{CETMODULES_PLUGIN_BUILDERS_PROJECT_${CETMODULES_CURRENT_PROJECT_NAME}})
set(CETMODULES_PLUGIN_BUILDERS_PROJECT_${CETMODULES_CURRENT_PROJECT_NAME}
CACHE INTERNAL
"CMake modules defining plugin builders for project ${CETMODULES_CURRENT_PROJECT_NAME}")
endif()
set_property(CACHE
CETMODULES_PLUGIN_BUILDERS_PROJECT_${CETMODULES_CURRENT_PROJECT_NAME}
APPEND PROPERTY VALUE "${TYPE}")
endfunction()

# This macro will generate a CMake builder function for plugins of type
# (e.g. inheriting from) TYPE.
function(cet_write_plugin_builder TYPE BASE DEST_SUBDIR)
Expand Down Expand Up @@ -384,47 +428,3 @@ endmacro()
DESTINATION "${DEST_SUBDIR}")
endif()
endfunction()

function(cet_make_plugin_builder TYPE BASE DEST_SUBDIR)
cet_write_plugin_builder(${ARGV} INSTALL_BUILDER)
if (NOT DEFINED
CACHE{CETMODULES_PLUGIN_BUILDERS_PROJECT_${CETMODULES_CURRENT_PROJECT_NAME}})
set(CETMODULES_PLUGIN_BUILDERS_PROJECT_${CETMODULES_CURRENT_PROJECT_NAME}
CACHE INTERNAL
"CMake modules defining plugin builders for project ${CETMODULES_CURRENT_PROJECT_NAME}")
endif()
set_property(CACHE
CETMODULES_PLUGIN_BUILDERS_PROJECT_${CETMODULES_CURRENT_PROJECT_NAME}
APPEND PROPERTY VALUE "${TYPE}")
endfunction()

function(cet_collect_plugin_builders DEST_SUBDIR)
cmake_parse_arguments(PARSE_ARGV 1 _ccpb "NOP" "" "LIST")
list(POP_FRONT _ccpb_UNPARSED_ARGUMENTS NAME_WE)
if ("${NAME_WE}" STREQUAL "")
if (NOT "${_ccpb_LIST}" STREQUAL "")
message(FATAL_ERROR "wrapper filepath required when LIST is specified")
endif()
set(NAME_WE ${CETMODULES_CURRENT_PROJECT_NAME}PluginBuilders)
endif()
if ("${_ccpb_LIST}" STREQUAL "")
set(_ccpb_LIST "${CETMODULES_PLUGIN_BUILDERS_PROJECT_${CETMODULES_CURRENT_PROJECT_NAME}}")
unset(CETMODULES_PLUGIN_BUILDERS_PROJECT_${CETMODULES_CURRENT_PROJECT_NAME} PARENT_SCOPE)
unset(CETMODULES_PLUGIN_BUILDERS_PROJECT_${CETMODULES_CURRENT_PROJECT_NAME} CACHE)
endif()
list(SORT _ccpb_LIST)
list(TRANSFORM _ccpb_LIST
REPLACE "^(.+)$" "include(\\1)" OUTPUT_VARIABLE _ccpb_includes)
list(JOIN _ccpb_includes "\n" _ccpb_includes_content)
file(WRITE
"${${CETMODULES_CURRENT_PROJECT_NAME}_BINARY_DIR}/${DEST_SUBDIR}/${NAME_WE}.cmake"
"\
include_guard()
${_ccpb_includes_content}
\
")
install(FILES
"${${CETMODULES_CURRENT_PROJECT_NAME}_BINARY_DIR}/${DEST_SUBDIR}/${NAME_WE}.cmake"
DESTINATION "${DEST_SUBDIR}")
endfunction()

0 comments on commit a32ba78

Please sign in to comment.