aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2021-11-01 07:40:32 +0100
committerPřemysl Eric Janouch <p@janouch.name>2021-11-01 07:40:32 +0100
commitd5ea2e2b4de90bb3eb4eaf83447881902afb2732 (patch)
tree54ae2105e3920dbd9d1d6bc902dff372f11378b0
parent0cec1b4badd0a5e26a8143f11666295b3d5d58fa (diff)
downloadlogdiag-d5ea2e2b4de90bb3eb4eaf83447881902afb2732.tar.gz
logdiag-d5ea2e2b4de90bb3eb4eaf83447881902afb2732.tar.xz
logdiag-d5ea2e2b4de90bb3eb4eaf83447881902afb2732.zip
Move GSettings schema checking to tests
-rw-r--r--CMakeLists.txt49
1 files changed, 23 insertions, 26 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0b39b76..ae588d3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -221,10 +221,33 @@ set_target_properties (liblogdiag PROPERTIES OUTPUT_NAME logdiag)
add_executable (logdiag WIN32 ${logdiag_SOURCES} ${logdiag_HEADERS})
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
if (BUILD_TESTING)
enable_testing ()
+ add_test (NAME test-gschema-${PROJECT_NAME}
+ COMMAND ${GLIB_COMPILE_SCHEMAS_EXECUTABLE} --dry-run "${GSETTINGS_DIR}")
+
foreach (name ${logdiag_TESTS})
add_executable (test-${name} tests/${name}.c)
target_link_libraries (test-${name} liblogdiag ${logdiag_LIBS})
@@ -298,32 +321,6 @@ if (OPTION_CLANG_TIDY)
USES_TERMINAL WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
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
if (WIN32)
install (TARGETS logdiag DESTINATION .)