SMTKSessionJSON.cmake 730 Bytes
Newer Older
1
# Given a list of filenames (opSpecs) containing JSON descriptions of
2
# a session, configure C++ source that encodes the JSON as a string.
3 4
# The resulting files are placed in the current binary directory and
# appended to genFiles.
5
include("${CMAKE_CURRENT_LIST_DIR}/EncodeCStringFunctions.cmake")
6
function(smtk_session_json opSpecs genFiles)
7 8 9 10 11 12 13 14
  foreach (opSpec ${opSpecs})
    get_filename_component(genFileBase "${opSpec}" NAME_WE)
    set(genFile "${CMAKE_CURRENT_BINARY_DIR}/${genFileBase}_json.h")
    #message("Writing ${genFileBase}_json.cxx (${opSpec})")
    configureFileAsCVariable("${opSpec}" "${genFile}" "${genFileBase}_json")
    set(${genFiles} ${${genFiles}} "${genFile}" PARENT_SCOPE)
  endforeach()
endfunction()