@@ -173,6 +173,28 @@ 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 (
192+ FATAL_ERROR
193+ "No targets were chosen to be build.See GODOTCPP_ADD_TARGET_* variables: at least one of the should be ON"
194+ )
195+ endif ()
196+ # parent scoping GODOTCPP_TARGETS
197+ set (GODOTCPP_TARGETS ${GODOTCPP_TARGETS} PARENT_SCOPE)
176198
177199 #[[ Target Platform Options ]]
178200 android_options()
@@ -310,7 +332,7 @@ function(godotcpp_generate)
310332 set (IS_DEV_BUILD "$<BOOL:${GODOTCPP_DEV_BUILD} >" )
311333
312334 ### Define our godot-cpp library targets
313- foreach (TARGET_ALIAS template_debug template_release editor )
335+ foreach (TARGET_ALIAS ${GODOTCPP_TARGETS} )
314336 set (TARGET_NAME "godot-cpp.${TARGET_ALIAS} " )
315337
316338 # Generator Expressions that rely on the target
0 commit comments