mirror of
https://github.com/gnif/LookingGlass.git
synced 2025-01-11 06:43:56 +00:00
47 lines
1.4 KiB
Text
47 lines
1.4 KiB
Text
|
cmake_minimum_required(VERSION 3.0)
|
||
|
project(clipboards LANGUAGES C)
|
||
|
|
||
|
set(CLIPBOARD_H "${CMAKE_BINARY_DIR}/include/dynamic/clipboards.h")
|
||
|
set(CLIPBOARD_C "${CMAKE_BINARY_DIR}/src/clipboards.c")
|
||
|
|
||
|
file(WRITE ${CLIPBOARD_H} "#include \"interface/clipboard.h\"\n\n")
|
||
|
file(APPEND ${CLIPBOARD_H} "extern LG_Clipboard * LG_Clipboards[];\n\n")
|
||
|
|
||
|
file(WRITE ${CLIPBOARD_C} "#include \"interface/clipboard.h\"\n\n")
|
||
|
file(APPEND ${CLIPBOARD_C} "#include <stddef.h>\n\n")
|
||
|
|
||
|
set(CLIPBOARDS)
|
||
|
set(CLIPBOARDS_LINK)
|
||
|
function(add_clipboard name)
|
||
|
set(CLIPBOARDS "${CLIPBOARDS};${name}" PARENT_SCOPE)
|
||
|
set(CLIPBOARDS_LINK "${CLIPBOARDS_LINK};clipboard_${name}" PARENT_SCOPE)
|
||
|
add_subdirectory(${name})
|
||
|
endfunction()
|
||
|
|
||
|
# Add/remove clipboards here!
|
||
|
add_clipboard(X11)
|
||
|
|
||
|
list(REMOVE_AT CLIPBOARDS 0)
|
||
|
list(REMOVE_AT CLIPBOARDS_LINK 0)
|
||
|
|
||
|
list(LENGTH CLIPBOARDS CLIPBOARD_COUNT)
|
||
|
file(APPEND ${CLIPBOARD_H} "#define LG_CLIPBOARD_COUNT ${CLIPBOARD_COUNT}\n")
|
||
|
|
||
|
foreach(clipboard ${CLIPBOARDS})
|
||
|
file(APPEND ${CLIPBOARD_C} "extern LG_Clipboard LGC_${clipboard};\n")
|
||
|
endforeach()
|
||
|
|
||
|
file(APPEND ${CLIPBOARD_C} "\nconst LG_Clipboard * LG_Clipboards[] =\n{\n")
|
||
|
foreach(clipboard ${CLIPBOARDS})
|
||
|
file(APPEND ${CLIPBOARD_C} " &LGC_${clipboard},\n")
|
||
|
endforeach()
|
||
|
file(APPEND ${CLIPBOARD_C} " NULL\n};\n\n")
|
||
|
|
||
|
add_library(clipboards STATIC
|
||
|
${CLIPBOARD_C}
|
||
|
)
|
||
|
|
||
|
target_link_libraries(clipboards
|
||
|
${CLIPBOARDS_LINK}
|
||
|
)
|