summaryrefslogtreecommitdiff
path: root/tests/CMakeLists.txt
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2021-06-24 22:04:12 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2021-06-24 22:04:12 +0200
commite1af9b35079a2ea771026f51ba1635824871d76d (patch)
tree24a13ed37c58f0dcce419fe08696a0b73e0360b9 /tests/CMakeLists.txt
parent1e475a33477dd9ad1572cfe1bae86a36e4f4438d (diff)
parentfb0975eb96f76ddfe6da372f3a43829064f612db (diff)
downloadlibayatana-common-e1af9b35079a2ea771026f51ba1635824871d76d.tar.gz
libayatana-common-e1af9b35079a2ea771026f51ba1635824871d76d.tar.bz2
libayatana-common-e1af9b35079a2ea771026f51ba1635824871d76d.zip
Merge branch 'tari01-pr/fix-spelling'
Attributes GH PR #31: https://github.com/AyatanaIndicators/libayatana-common/pull/31
Diffstat (limited to 'tests/CMakeLists.txt')
-rw-r--r--tests/CMakeLists.txt22
1 files changed, 20 insertions, 2 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index d0d05c0..4fa6602 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -2,11 +2,28 @@ find_package(GMock)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -no-pie")
-include_directories(
- ${CMAKE_SOURCE_DIR}/src
+# gschemas.compiled
+
+set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "gschemas.compiled")
+set_source_files_properties("gschemas.compiled" GENERATED)
+execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} gio-2.0 --variable glib_compile_schemas OUTPUT_VARIABLE COMPILE_SCHEMA_EXECUTABLE OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+add_custom_command(
+ OUTPUT "gschemas.compiled"
+ DEPENDS "${CMAKE_BINARY_DIR}/data/org.ayatana.common.gschema.xml"
+ COMMAND cp -f "${CMAKE_BINARY_DIR}/data/org.ayatana.common.gschema.xml" "${CMAKE_CURRENT_BINARY_DIR}"
+ COMMAND ${COMPILE_SCHEMA_EXECUTABLE} "${CMAKE_CURRENT_BINARY_DIR}"
)
+add_custom_target("gschemas-compiled" ALL DEPENDS "gschemas.compiled")
+
+# tst_utils
+
add_executable(tst_utils tst_utils.cpp)
+target_compile_definitions(tst_utils PUBLIC SCHEMA_DIR="${CMAKE_CURRENT_BINARY_DIR}")
+add_dependencies(tst_utils "gschemas-compiled")
+target_include_directories(tst_utils PUBLIC "${CMAKE_SOURCE_DIR}/src")
+
target_link_libraries(tst_utils
ayatana-common
${GLIB_LIBRARIES}
@@ -14,4 +31,5 @@ target_link_libraries(tst_utils
${GTEST_BOTH_LIBRARIES}
${GMOCK_LIBRARIES}
)
+
add_test(TstUtils tst_utils)