# @project The CERN Tape Archive (CTA) # @copyright Copyright © 2015-2022 CERN # @license This program is free software, distributed under the terms of the GNU General Public # Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". You can # redistribute it and/or modify it under the terms of the GPL Version 3, or (at your # option) any later version. # # This program is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. See the GNU General Public License for more details. # # In applying this licence, CERN does not waive the privileges and immunities # granted to it by virtue of its status as an Intergovernmental Organization or # submit itself to any jurisdiction. cmake_minimum_required (VERSION 3.17) project(cta-catalogue-schema) include(CTACatalogueSchemaVersion.cmake) #Generate insert_cta_catalogue_version.sql configure_file(${CMAKE_CURRENT_SOURCE_DIR}/insert_cta_catalogue_version.sql.in insert_cta_catalogue_version.sql) set(catalogue_schema_directory ${CMAKE_CURRENT_SOURCE_DIR}/${CTA_CATALOGUE_SCHEMA_VERSION_MAJOR}.${CTA_CATALOGUE_SCHEMA_VERSION_MINOR}) add_custom_command( OUTPUT oracle_catalogue_schema.sql sqlite_catalogue_schema.sql postgres_catalogue_schema.sql COMMAND ${CMAKE_COMMAND} -E env "LC_ALL=C" ${CMAKE_COMMAND} -E make_directory ${catalogue_schema_directory} DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/CTACatalogueSchemaVersion.cmake COMMAND sh ${CMAKE_CURRENT_SOURCE_DIR}/CreateAllSchemasSQL.sh ${CMAKE_CURRENT_SOURCE_DIR} ${catalogue_schema_directory} >/dev/null DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/CTACatalogueSchemaVersion.cmake ${CMAKE_CURRENT_SOURCE_DIR}/common_catalogue_schema.sql ${CMAKE_CURRENT_SOURCE_DIR}/oracle_catalogue_schema_header.sql ${CMAKE_CURRENT_SOURCE_DIR}/oracle_catalogue_schema_trailer.sql ${CMAKE_CURRENT_SOURCE_DIR}/sqlite_catalogue_schema_header.sql ${CMAKE_CURRENT_SOURCE_DIR}/sqlite_catalogue_schema_trailer.sql ${CMAKE_CURRENT_SOURCE_DIR}/postgres_catalogue_schema_header.sql ${CMAKE_CURRENT_SOURCE_DIR}/postgres_catalogue_schema_trailer.sql ${CMAKE_CURRENT_SOURCE_DIR}/CreateAllSchemasSQL.sh insert_cta_catalogue_version.sql) add_custom_target(create_all_schemas_SQL ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/oracle_catalogue_schema.sql ${CMAKE_CURRENT_BINARY_DIR}/sqlite_catalogue_schema.sql ${CMAKE_CURRENT_BINARY_DIR}/postgres_catalogue_schema.sql )