@@ -173,6 +173,25 @@ function(godotcpp_options)
173173
174174 # Enable Testing
175175 option (GODOTCPP_ENABLE_TESTING "Enable the godot-cpp.test.<target> integration testing targets" OFF )
176+ # Define which targets create for build. By default all targets are included
177+ # Not presented in SCons
178+ option (GODOTCPP_ADD_TARGET_TEMPLATE_RELEASE "Add template_release target to build" ON )
179+ option (GODOTCPP_ADD_TARGET_TEMPLATE_DEBUG "Add template_debug target to build" ON )
180+ option (GODOTCPP_ADD_TARGET_EDITOR "Add editor target to build" ON )
181+ if (GODOTCPP_ADD_TARGET_TEMPLATE_DEBUG)
182+ list (APPEND GODOTCPP_TARGETS "template_debug" )
183+ endif ()
184+ if (GODOTCPP_ADD_TARGET_TEMPLATE_RELEASE)
185+ list (APPEND GODOTCPP_TARGETS "template_release" )
186+ endif ()
187+ if (GODOTCPP_ADD_TARGET_EDITOR)
188+ list (APPEND GODOTCPP_TARGETS "editor" )
189+ endif ()
190+ if (NOT GODOTCPP_TARGETS)
191+ message (FATAL_ERROR "No targets were chosen to be build.See GODOTCPP_ADD_TARGET_* variables: at least one of the should be ON" )
192+ endif ()
193+ # parent scoping GODOTCPP_TARGETS
194+ set (GODOTCPP_TARGETS ${GODOTCPP_TARGETS} PARENT_SCOPE)
176195
177196 #[[ Target Platform Options ]]
178197 android_options()
@@ -310,7 +329,7 @@ function(godotcpp_generate)
310329 set (IS_DEV_BUILD "$<BOOL:${GODOTCPP_DEV_BUILD} >" )
311330
312331 ### Define our godot-cpp library targets
313- foreach (TARGET_ALIAS template_debug template_release editor )
332+ foreach (TARGET_ALIAS ${GODOTCPP_TARGETS} )
314333 set (TARGET_NAME "godot-cpp.${TARGET_ALIAS} " )
315334
316335 # Generator Expressions that rely on the target
0 commit comments