# Copy share/ to the build folder
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/
        REGEX "(CMakeLists.txt|\\.am$)" EXCLUDE)

if (OCTOPUS_INSTALL)
    # Copy all contents from build folder, which include files/folders generated at configure time
    install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/ DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/octopus
            REGEX "(CMakeLists.txt|\\.am$)" EXCLUDE)

    # Copy contents of share/opencl, such that any changes to the kernels following configure
    # are available to the installation
    install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/opencl/ DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/octopus/opencl
            REGEX "(CMakeLists.txt|\\.am$)" EXCLUDE)
endif ()
