set(_INCDIR ${CMAKE_CURRENT_BINARY_DIR}/include/kross)
file(MAKE_DIRECTORY ${_INCDIR})

file(GLOB _KROSSCOREHEADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/core core/*.h)
#message(STATUS _KROSSCOREHEADERS=${_KROSSCOREHEADERS})
foreach(_KROSSCOREHEADER ${_KROSSCOREHEADERS})
    string(REGEX MATCH ".*_p\\.h" _ISPRIVATE ${_KROSSCOREHEADER})
    #message(STATUS "_ISPRIVATE=${_ISPRIVATE} _KROSSCOREHEADER=${_KROSSCOREHEADER}")
    if (NOT _ISPRIVATE)
        if (NOT EXISTS ${_INCDIR}/core/${_KROSSCOREHEADER})
            file(WRITE ${_INCDIR}/core/${_KROSSCOREHEADER} "#include \"${CMAKE_CURRENT_SOURCE_DIR}/core/${_KROSSCOREHEADER}\"\n")
        endif()
    endif()
endforeach()
if (NOT EXISTS ${_INCDIR}/core/krosscore_export.h)
    file(WRITE ${_INCDIR}/core/krosscore_export.h "#include \"${CMAKE_CURRENT_BINARY_DIR}/core/krosscore_export.h\"\n")
endif()

file(GLOB _KROSSUIHEADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/ui ui/*.h)
#message(STATUS _KROSSUIHEADERS=${_KROSSUIHEADERS})
foreach(_KROSSUIHEADER ${_KROSSUIHEADERS})
   string(REGEX MATCH ".*_p\\.h" _ISPRIVATE ${_KROSSUIHEADER})
   #message(STATUS "_ISPRIVATE=${_ISPRIVATE} _KROSSUIHEADER=${_KROSSUIHEADER}")
    if (NOT _ISPRIVATE)
       if (NOT EXISTS ${_INCDIR}/ui/${_KROSSUIHEADER})
          file(WRITE ${_INCDIR}/ui/${_KROSSUIHEADER} "#include \"${CMAKE_CURRENT_SOURCE_DIR}/ui/${_KROSSUIHEADER}\"\n")
        endif()
    endif()
endforeach()
if (NOT EXISTS ${_INCDIR}/ui/krossui_export.h)
    file(WRITE ${_INCDIR}/ui/krossui_export.h "#include \"${CMAKE_CURRENT_BINARY_DIR}/ui/krossui_export.h\"\n")
endif()

add_subdirectory( core )
add_subdirectory( ui )
add_subdirectory( modules )
add_subdirectory( console )

# QtScript backend
add_subdirectory( qts )
