blob: c3c6a09a41a6b2882a6c0db468e54f43bfe2fbdc [file] [log] [blame]
# Copyright (C) 2016 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
embed(PACKAGE main stringdef.tmpl)
go_install()
function(stringgen)
if(NOT TARGET stringgen)
return()
endif()
get_filename_component(name ${CMAKE_CURRENT_SOURCE_DIR} NAME)
cmake_parse_arguments(STRINGGEN "" "INPUT;OUTPUT;PACKAGE" "" ${ARGN})
required(STRINGGEN_INPUT "for stringgen")
required(STRINGGEN_OUTPUT "for stringgen")
required(STRINGGEN_PACKAGE "for stringgen")
set(STRINGGEN_OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/${STRINGGEN_OUTPUT})
set(STRINGGEN_INPUT ${CMAKE_CURRENT_SOURCE_DIR}/${STRINGGEN_INPUT})
add_custom_command(
OUTPUT ${STRINGGEN_OUTPUT}
COMMAND stringgen
--def ${STRINGGEN_OUTPUT}
--pkg ${STRINGGEN_PACKAGE}
${STRINGGEN_INPUT}
DEPENDS stringgen ${STRINGGEN_INPUT}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "stringgen using ${STRINGGEN_INPUT}"
)
all_target(stringgen ${name} ${STRINGGEN_OUTPUT})
endfunction(stringgen)