Skip to content

Commit

Permalink
{cmake} Ensure CMAKE_BUILD_TYPE is set to "Debug" or "Release" (#27)
Browse files Browse the repository at this point in the history
Not ideal, but we need a fix to godot-cpp.

See #25.
  • Loading branch information
asmaloney authored Dec 31, 2022
1 parent 28f407c commit 47d7313
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions templates/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ add_custom_target( templates

add_dependencies( ${PROJECT_NAME} templates )

# We shouldn't be relying on CMAKE_BUILD_TYPE (see https://github.com/asmaloney/GDExtensionTemplate/issues/25)
# But until we fix it here and in godot-cpp, ensure it's one we expect.
set ( ALLOWED_BUILDS "Debug;Release" )
if ( NOT "${CMAKE_BUILD_TYPE}" IN_LIST ALLOWED_BUILDS )
message( FATAL_ERROR "CMAKE_BUILD_TYPE must be set to Debug or Release" )
endif()

# Get our gdextension input file name based on build type
string( TOLOWER ${CMAKE_BUILD_TYPE} BUILD_TYPE )
set( GD_EXTENSION_FILE_INPUT template.${BUILD_TYPE}.gdextension.in )
Expand All @@ -27,6 +34,7 @@ install(
DESTINATION ${INSTALL_DIR}
)

unset( ALLOWED_BUILDS )
unset( BUILD_TYPE )
unset( GD_EXTENSION_FILE )
unset( GD_EXTENSION_FILE_INPUT )
Expand Down

0 comments on commit 47d7313

Please sign in to comment.