1
0
Fork 0
mirror of https://github.com/KingDuckZ/dindexer.git synced 2024-11-25 00:53:43 +00:00

Allow users to selectively build backends.

Pass -DDINDEXER_ENABLED_BACKENDS="list,of,backends" to cmake to tell
which backends you want to be built. Currently available backends are
postgresql and redis. Default is postgresql.
Allowed strings in the comma separated list above are the names of the
directories in src/backends.
This commit is contained in:
King_DuckZ 2016-06-14 11:03:31 +01:00
parent a5d5ee5af5
commit 2a696aa62a

View file

@ -1,6 +1,8 @@
project(${bare_name}-backend CXX)
set(BACKEND_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}")
set(DINDEXER_ENABLED_BACKENDS "postgresql" CACHE STRING "Comma separated list of enabled backends. See directories in backends source directory for a list of known backends.")
function(ln_backend backend_name)
add_custom_command(TARGET "${backend_name}" POST_BUILD
COMMAND ${CMAKE_COMMAND} -E create_symlink $<TARGET_FILE:${backend_name}> ${BACKEND_BINARY_DIR}/$<TARGET_FILE_NAME:${backend_name}>
@ -27,13 +29,9 @@ target_link_libraries(${PROJECT_NAME}
INTERFACE ${bare_name}-machinery
)
#install(TARGETS ${PROJECT_NAME}
# LIBRARY DESTINATION lib
# RUNTIME DESTINATION bin
# ARCHIVE DESTINATION lib/static
#)
add_subdirectory(postgresql)
add_subdirectory(redis)
add_dependencies(${PROJECT_NAME} ${bare_name}-backend-postgresql)
add_dependencies(${PROJECT_NAME} ${bare_name}-backend-redis)
string(REPLACE "," ";" backend_list "${DINDEXER_ENABLED_BACKENDS}")
foreach(backend ${backend_list})
add_subdirectory(${backend})
add_dependencies(${PROJECT_NAME} ${bare_name}-backend-${backend})
endforeach()
unset(backend)