Move GSettings schema checking to tests
This commit is contained in:
parent
0cec1b4bad
commit
d5ea2e2b4d
|
@ -221,10 +221,33 @@ set_target_properties (liblogdiag PROPERTIES OUTPUT_NAME logdiag)
|
||||||
add_executable (logdiag WIN32 ${logdiag_SOURCES} ${logdiag_HEADERS})
|
add_executable (logdiag WIN32 ${logdiag_SOURCES} ${logdiag_HEADERS})
|
||||||
target_link_libraries (logdiag liblogdiag ${logdiag_LIBS})
|
target_link_libraries (logdiag liblogdiag ${logdiag_LIBS})
|
||||||
|
|
||||||
|
# GSettings
|
||||||
|
find_program (GLIB_COMPILE_SCHEMAS_EXECUTABLE glib-compile-schemas)
|
||||||
|
if (NOT GLIB_COMPILE_SCHEMAS_EXECUTABLE)
|
||||||
|
message (FATAL_ERROR "glib-compile-schemas not found")
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
set (GSETTINGS_DIR "${PROJECT_SOURCE_DIR}/share")
|
||||||
|
set (GSETTINGS_SCHEMAS "${GSETTINGS_DIR}/org.logdiag.gschema.xml")
|
||||||
|
|
||||||
|
if (OPTION_NOINSTALL)
|
||||||
|
set (GSETTINGS_COMPILED_SCHEMA "${PROJECT_BINARY_DIR}/gschemas.compiled")
|
||||||
|
add_custom_command (OUTPUT "${GSETTINGS_COMPILED_SCHEMA}"
|
||||||
|
COMMAND ${GLIB_COMPILE_SCHEMAS_EXECUTABLE}
|
||||||
|
"--targetdir=${PROJECT_BINARY_DIR}" "${GSETTINGS_DIR}"
|
||||||
|
DEPENDS "${GSETTINGS_SCHEMAS}"
|
||||||
|
COMMENT "Compiling GSettings schema files" VERBATIM)
|
||||||
|
add_custom_target (${PROJECT_NAME}-gschema ALL
|
||||||
|
DEPENDS "${GSETTINGS_COMPILED_SCHEMA}")
|
||||||
|
endif ()
|
||||||
|
|
||||||
# Testing
|
# Testing
|
||||||
if (BUILD_TESTING)
|
if (BUILD_TESTING)
|
||||||
enable_testing ()
|
enable_testing ()
|
||||||
|
|
||||||
|
add_test (NAME test-gschema-${PROJECT_NAME}
|
||||||
|
COMMAND ${GLIB_COMPILE_SCHEMAS_EXECUTABLE} --dry-run "${GSETTINGS_DIR}")
|
||||||
|
|
||||||
foreach (name ${logdiag_TESTS})
|
foreach (name ${logdiag_TESTS})
|
||||||
add_executable (test-${name} tests/${name}.c)
|
add_executable (test-${name} tests/${name}.c)
|
||||||
target_link_libraries (test-${name} liblogdiag ${logdiag_LIBS})
|
target_link_libraries (test-${name} liblogdiag ${logdiag_LIBS})
|
||||||
|
@ -298,32 +321,6 @@ if (OPTION_CLANG_TIDY)
|
||||||
USES_TERMINAL WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
|
USES_TERMINAL WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
# GSettings
|
|
||||||
find_program (GLIB_COMPILE_SCHEMAS_EXECUTABLE glib-compile-schemas)
|
|
||||||
if (NOT GLIB_COMPILE_SCHEMAS_EXECUTABLE)
|
|
||||||
message (FATAL_ERROR "glib-compile-schemas not found")
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
set (GSETTINGS_DIR "${PROJECT_SOURCE_DIR}/share")
|
|
||||||
set (GSETTINGS_SCHEMAS "${GSETTINGS_DIR}/org.logdiag.gschema.xml")
|
|
||||||
|
|
||||||
add_custom_target (${PROJECT_NAME}_gschema_check
|
|
||||||
COMMAND ${GLIB_COMPILE_SCHEMAS_EXECUTABLE} --dry-run "${GSETTINGS_DIR}"
|
|
||||||
DEPENDS "${GSETTINGS_SCHEMAS}"
|
|
||||||
COMMENT "Checking GSettings schema files" VERBATIM)
|
|
||||||
|
|
||||||
if (OPTION_NOINSTALL)
|
|
||||||
set (GSETTINGS_COMPILED_SCHEMA "${PROJECT_BINARY_DIR}/gschemas.compiled")
|
|
||||||
|
|
||||||
add_custom_command (OUTPUT "${GSETTINGS_COMPILED_SCHEMA}"
|
|
||||||
COMMAND ${GLIB_COMPILE_SCHEMAS_EXECUTABLE}
|
|
||||||
"--targetdir=${PROJECT_BINARY_DIR}" "${GSETTINGS_DIR}"
|
|
||||||
DEPENDS "${GSETTINGS_SCHEMAS}"
|
|
||||||
COMMENT "Compiling GSettings schema files" VERBATIM)
|
|
||||||
add_custom_target (${PROJECT_NAME}_gschema ALL
|
|
||||||
DEPENDS "${GSETTINGS_COMPILED_SCHEMA}")
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
# Installation
|
# Installation
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
install (TARGETS logdiag DESTINATION .)
|
install (TARGETS logdiag DESTINATION .)
|
||||||
|
|
Loading…
Reference in New Issue