Skip to content

Commit 55cbea7

Browse files
authored
Merge pull request godotengine#1728 from enetheru/default_target
CMake: template_debug as default target when godot-cpp is top level
2 parents 05f5d73 + 8b33e73 commit 55cbea7

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,17 @@ function is run.
3636
3737
The CMake equivalent is below.
3838
]=======================================================================]
39-
4039
include(cmake/godotcpp.cmake)
4140

4241
godotcpp_options()
4342

43+
#[[ People are compiling godot by itself and expecting template_debug
44+
Replace this with PROJECT_IS_TOP_LEVEL, <PROJECT-NAME>_IS_TOP_LEVEL when minimum reaches 3.21
45+
]]
46+
if(NOT PROJECT_NAME)
47+
set(GODOTCPP_IS_TOP_LEVEL ON)
48+
endif()
49+
4450
# Define our project.
4551
project(
4652
godot-cpp

cmake/godotcpp.cmake

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,8 +330,17 @@ function(godotcpp_generate)
330330
"$<$<NOT:${THREADS_ENABLED}>:.nothreads>"
331331
)
332332

333+
# People are compiling godot by itself.
334+
set(EXCLUDE EXCLUDE_FROM_ALL)
335+
if(GODOTCPP_IS_TOP_LEVEL)
336+
if(TARGET_ALIAS STREQUAL template_debug)
337+
set(EXCLUDE "")
338+
endif()
339+
endif()
340+
333341
# the godot-cpp.* library targets
334-
add_library(${TARGET_NAME} STATIC EXCLUDE_FROM_ALL)
342+
add_library(${TARGET_NAME} STATIC ${EXCLUDE})
343+
335344
add_library(godot-cpp::${TARGET_ALIAS} ALIAS ${TARGET_NAME})
336345

337346
file(GLOB_RECURSE GODOTCPP_SOURCES LIST_DIRECTORIES NO CONFIGURE_DEPENDS src/*.cpp)

0 commit comments

Comments
 (0)