diff --git a/CMakeLists.txt b/CMakeLists.txt index 47dab79f..e00df0db 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,6 +18,7 @@ option(GEODE_USE_BREAKPAD "Enables the use of the Breakpad library for crash dum # Read version file(READ VERSION GEODE_VERSION) string(STRIP "${GEODE_VERSION}" GEODE_VERSION) +set(GEODE_VERSION "${GEODE_VERSION}" CACHE INTERNAL "Geode version") # Check if version has a tag like v1.0.0-alpha string(FIND ${GEODE_VERSION} "-" GEODE_VERSION_HAS_TAG) diff --git a/cmake/GeodeFile.cmake b/cmake/GeodeFile.cmake index 613911cc..df1a5df7 100644 --- a/cmake/GeodeFile.cmake +++ b/cmake/GeodeFile.cmake @@ -86,9 +86,19 @@ function(setup_geode_mod proname) file(READ "${CMAKE_CURRENT_SOURCE_DIR}/mod.json" MOD_JSON) string(JSON MOD_ID GET "${MOD_JSON}" "id") string(JSON MOD_VERSION GET "${MOD_JSON}" "version") + string(JSON TARGET_GEODE_VERSION GET "${MOD_JSON}" "geode") string(JSON MOD_HAS_API ERROR_VARIABLE MOD_DOESNT_HAVE_API GET "${MOD_JSON}" "api") string(JSON MOD_HAS_DEPS ERROR_VARIABLE MOD_DOESNT_HAVE_DEPS GET "${MOD_JSON}" "dependencies") + if ("${TARGET_GEODE_VERSION}" STREQUAL "${GEODE_VERSION}") + message(STATUS "Mod ${MOD_ID} is compiling for Geode version ${GEODE_VERSION}") + else() + message(FATAL_ERROR + "Mod ${MOD_ID} is not compatible with Geode version ${GEODE_VERSION} - " + "it was made for version ${TARGET_GEODE_VERSION}" + ) + endif() + # Add this mod to the list of known externals mods list(APPEND GEODE_MODS_BEING_BUILT "${MOD_ID}:${MOD_VERSION}") # Ensure that the list of mods being built is global (persists between setup_geode_mod calls)