Advertisement
KukuRuzo

work with plugins changed

Jul 11th, 2024
393
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 4.34 KB | None | 0 0
  1. diff --git a/CMakeLists.txt b/CMakeLists.txt
  2. index 44422f59..4f214dc8 100644
  3. --- a/CMakeLists.txt
  4. +++ b/CMakeLists.txt
  5. @@ -30,8 +30,7 @@ set_directory_properties(PROPERTIES
  6.      COMPILE_DEFINITIONS ""
  7.  )
  8.  
  9. -set( CMAKE_MODULE_PATH
  10. -    ${CMAKE_MODULE_PATH}
  11. +list(APPEND CMAKE_MODULE_PATH
  12.      ${PROJECT_SOURCE_DIR}/cmake/modules
  13.      ${CMAKE_CURRENT_LIST_DIR}/cmake/modules
  14.  )
  15. diff --git a/dev/CMakeLists.txt b/dev/CMakeLists.txt
  16. index 9085d7bc..fc94a309 100644
  17. --- a/dev/CMakeLists.txt
  18. +++ b/dev/CMakeLists.txt
  19. @@ -8,16 +8,17 @@ set( plugins_list
  20.  message(STATUS "Plugins from dev subdirectory")
  21.  # If BUILD_PLUGINS variable was set as "-plugin1;-plugin2"
  22.  # We proceed all plugins with plugin1 and plugin2 excluded
  23. -string(REGEX MATCH ".*[-]*" DISABLED_PLUGINS "${BUILD_PLUGINS}")
  24. +string(REGEX MATCHALL "[-][^;]+" DISABLED_PLUGINS "${BUILD_PLUGINS}")
  25.  if(NOT "${DISABLED_PLUGINS}" STREQUAL "")
  26. +    string(REPLACE "-" "" DISABLED_LIST "${DISABLED_PLUGINS}")
  27.      set(plugins ${plugins_list})
  28. -    foreach(mp ${BUILD_PLUGINS})
  29. -        string(SUBSTRING "${mp}" 0 1 FIRST_LETTER)
  30. -        string(SUBSTRING ${mp} 1 -1 PLUGIN_BODY)
  31. -        if(${FIRST_LETTER} STREQUAL "-")
  32. -            message(STATUS "Exclude subdirectory: ${PLUGIN_BODY}")
  33. -            list(REMOVE_ITEM plugins "${PLUGIN_BODY}")
  34. +    foreach(dp ${DISABLED_LIST})
  35. +        list(FIND plugins "${dp}" _IS_FOUND)
  36. +        if(${_IS_FOUND} GREATER_EQUAL 0)
  37. +            message(STATUS "Exclude subdirectory: ${dp}")
  38. +            list(REMOVE_ITEM plugins "${dp}")
  39.          endif()
  40. +        unset(_IS_FOUND)
  41.      endforeach()
  42.  else()
  43.      if( "${BUILD_PLUGINS}" STREQUAL "ALL" )
  44. @@ -27,11 +28,13 @@ else()
  45.      endif()
  46.  endif()
  47.  
  48. -foreach( plugin ${plugins_list} )
  49. -    foreach( subdir ${plugins} )
  50. -        if( ${plugin} STREQUAL ${subdir} )
  51. -            message(STATUS "Add subdirectory: ${plugin}")
  52. -            add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/${plugin}")
  53. -        endif()
  54. -    endforeach()
  55. +foreach(plugin ${plugins})
  56. +    list(FIND plugins_list "${plugin}" _IS_FOUND)
  57. +    if(${_IS_FOUND} GREATER_EQUAL 0)
  58. +        message(STATUS "Add subdirectory: ${plugin}")
  59. +        add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/${plugin}")
  60. +    else()
  61. +        message(WARNING "Plugin ${plugin} set by BUILD_PLUGINS variable not found")
  62. +    endif()
  63. +    unset(_IS_FOUND)
  64.  endforeach()
  65. diff --git a/generic/CMakeLists.txt b/generic/CMakeLists.txt
  66. index 3b7b313d..3b691d85 100644
  67. --- a/generic/CMakeLists.txt
  68. +++ b/generic/CMakeLists.txt
  69. @@ -46,16 +46,17 @@ endif()
  70.  message(STATUS "Plugins from generic subdirectory")
  71.  # If BUILD_PLUGINS variable was set as "-plugin1;-plugin2"
  72.  # We proceed all plugins with plugin1 and plugin2 excluded
  73. -string(REGEX MATCH ".*[-]+" DISABLED_PLUGINS "${BUILD_PLUGINS}")
  74. +string(REGEX MATCHALL "[-][^;]+" DISABLED_PLUGINS "${BUILD_PLUGINS}")
  75.  if(NOT "${DISABLED_PLUGINS}" STREQUAL "")
  76. +    string(REPLACE "-" "" DISABLED_LIST "${DISABLED_PLUGINS}")
  77.      set(plugins ${plugins_list})
  78. -    foreach(mp ${BUILD_PLUGINS})
  79. -        string(SUBSTRING "${mp}" 0 1 FIRST_LETTER)
  80. -        string(SUBSTRING ${mp} 1 -1 PLUGIN_BODY)
  81. -        if(${FIRST_LETTER} STREQUAL "-")
  82. -            message(STATUS "Exclude subdirectory: ${PLUGIN_BODY}")
  83. -            list(REMOVE_ITEM plugins "${PLUGIN_BODY}")
  84. +    foreach(dp ${DISABLED_LIST})
  85. +        list(FIND plugins "${dp}" _IS_FOUND)
  86. +        if(${_IS_FOUND} GREATER_EQUAL 0)
  87. +            message(STATUS "Exclude subdirectory: ${dp}")
  88. +            list(REMOVE_ITEM plugins "${dp}")
  89.          endif()
  90. +        unset(_IS_FOUND)
  91.      endforeach()
  92.  else()
  93.      if( "${BUILD_PLUGINS}" STREQUAL "ALL" )
  94. @@ -65,11 +66,13 @@ else()
  95.      endif()
  96.  endif()
  97.  
  98. -foreach(plugin ${plugins_list})
  99. -    foreach(subdir ${plugins})
  100. -        if( ${plugin} STREQUAL ${subdir} )
  101. -            message(STATUS "Add subdirectory: ${plugin}")
  102. -            add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/${plugin}")
  103. -        endif()
  104. -    endforeach()
  105. +foreach(plugin ${plugins})
  106. +    list(FIND plugins_list "${plugin}" _IS_FOUND)
  107. +    if(${_IS_FOUND} GREATER_EQUAL 0)
  108. +        message(STATUS "Add subdirectory: ${plugin}")
  109. +        add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/${plugin}")
  110. +    else()
  111. +        message(WARNING "Plugin ${plugin} set by BUILD_PLUGINS variable not found")
  112. +    endif()
  113. +    unset(_IS_FOUND)
  114.  endforeach()
  115.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement