diff --git a/cmake/scripts/SquirrelIncludes.cmake b/cmake/scripts/SquirrelIncludes.cmake --- a/cmake/scripts/SquirrelIncludes.cmake +++ b/cmake/scripts/SquirrelIncludes.cmake @@ -12,32 +12,11 @@ endif() if(NOT APIUC) message(FATAL_ERROR "Script needs APIUC defined") endif() - -set(ARGC 1) -set(ARG_READ NO) - -# For MSVC CMake runs this script from a batch file using || to detect errors, -# depending on source path it may quote args, and cause cmd to not understand || -# and pass it as argument to ourself. -# Read all the arguments given to CMake; we are looking for -- and everything -# that follows, until ||. Those are our api files. -while(ARGC LESS CMAKE_ARGC) - set(ARG ${CMAKE_ARGV${ARGC}}) +if(NOT API_FILES) + message(FATAL_ERROR "Script needs API_FILES defined") +endif() - if(ARG STREQUAL "||") - set(ARG_READ NO) - endif() - - if(ARG_READ) - list(APPEND SCRIPT_API_BINARY_FILES "${ARG}") - endif() - - if(ARG STREQUAL "--") - set(ARG_READ YES) - endif() - - math(EXPR ARGC "${ARGC} + 1") -endwhile() +file(READ "${API_FILES}" SCRIPT_API_BINARY_FILES) foreach(FILE IN LISTS SCRIPT_API_BINARY_FILES) file(STRINGS "${FILE}" LINES REGEX "^void SQ${APIUC}.*_Register\\(Squirrel \\*engine\\)$")