turtle-wow-source-kinda/Dumps/Source Code/16 - Development_server/patch_1171/cmake/migrations.cmake
Brian Oost a1d5bb70b2 Init
2024-08-06 18:06:40 +02:00

32 lines
828 B
CMake

file(GLOB migrations
RELATIVE "${CMAKE_SOURCE_DIR}/sql/migrations"
"${CMAKE_SOURCE_DIR}/sql/migrations/*.sql"
)
foreach(migration ${migrations})
string(REGEX MATCH "^(.*)_(.*)\\.sql$" match ${migration})
set("migrations_${CMAKE_MATCH_2}"
"${migrations_${CMAKE_MATCH_2}}\n\t\"${CMAKE_MATCH_1}\",")
endforeach()
file(WRITE "src/shared/migrations_list.h"
"#ifndef MIGRATIONS_LIST_H\n"
"#define MIGRATIONS_LIST_H\n"
"\n"
"#include <cstddef>\n"
"\n"
"static const char *MIGRATIONS_CHARACTERS[] =\n{"
${migrations_characters}
"\n\tNULL\n};\n\n"
"static const char *MIGRATIONS_WORLD[] =\n{"
${migrations_world}
"\n\tNULL\n};\n\n"
"static const char *MIGRATIONS_LOGON[] =\n{"
${migrations_logon}
"\n\tNULL\n};\n\n"
"static const char *MIGRATIONS_LOGS[] =\n{"
${migrations_logs}
"\n\tNULL\n};\n\n"
"#endif\n"
)