build libyang_ext_test only in debug mode

Signed-off-by: Mislav Novakovic <mislav.novakovic@sartura.hr>
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 72f70cf..5b5b8e7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -310,9 +310,9 @@
 # if the tests are enabled, build libyang_ext_test
 if(ENABLE_BUILD_TESTS)
     find_package(CMocka 1.0.0)
-    if(CMOCKA_FOUND)
+    if(CMOCKA_FOUND AND CMAKE_BUILD_TYPE MATCHES debug)
         list(APPEND EXTENSIONS_LIST "libyang_ext_test")
-    endif(CMOCKA_FOUND)
+    endif(CMOCKA_FOUND AND CMAKE_BUILD_TYPE MATCHES debug)
 endif(ENABLE_BUILD_TESTS)
 
 if(ENABLE_STATIC)
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index c14e710..e3ff82b 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -6,7 +6,10 @@
 set(api_tests test_libyang test_tree_schema test_xml test_dict test_tree_data test_tree_data_dup test_tree_data_merge test_xpath test_xpath_1.1 test_diff test_hash_table)
 set(data_tests test_data_initialization test_leafref_remove test_instid_remove test_keys test_autodel test_when test_when_1.1 test_must_1.1 test_defaults test_emptycont test_unique test_mandatory test_json test_parse_print test_values test_metadata test_yangtypes_xpath test_yang_data test_state_lists test_unknown_element)
 set(schema_yin_tests test_print_transform)
-set(schema_tests test_ietf test_augment test_deviation test_refine test_typedef test_import test_include test_feature test_conformance test_leaflist test_extensions test_status test_printer)
+set(schema_tests test_ietf test_augment test_deviation test_refine test_typedef test_import test_include test_feature test_conformance test_leaflist test_status test_printer)
+if(CMAKE_BUILD_TYPE MATCHES debug)
+    list(APPEND schema_tests test_extensions)
+endif(CMAKE_BUILD_TYPE MATCHES debug)
 set(conformance_tests test_sec6_1_1 test_sec6_2 test_sec5_1 test_sec5_5 test_sec6_1_3 test_sec6_2_1 test_sec7_1 test_sec7_2 test_sec7_3 test_sec7_3_1 test_sec7_3_4 test_sec7_5_2 test_sec7_5_4 test_sec7_5_5 test_sec7_6_2 test_sec7_6_3 test_sec7_6_4 test_sec7_6_5 test_sec7_7_2 test_sec7_7_3 test_sec7_7_4 test_sec7_7_5 test_sec7_8_1 test_sec7_8_2 test_sec7_8_3 test_sec7_9_1 test_sec7_9_2 test_sec7_9_3 test_sec7_9_4 test_sec7_10 test_sec7_11 test_sec7_12_1 test_sec7_12_2 test_sec7_13_1 test_sec7_13_2 test_sec7_13_3 test_sec7_14 test_sec7_15 test_sec7_16_1 test_sec7_16_2 test_sec7_18_1 test_sec7_18_2 test_sec7_18_3_1 test_sec7_18_3_2 test_sec7_19_1 test_sec7_19_2 test_sec7_19_5 test_sec9_2 test_sec9_3 test_sec9_4_4 test_sec9_4_6 test_sec9_5 test_sec9_6 test_sec9_7 test_sec9_8 test_sec9_9 test_sec9_10 test_sec9_11 test_sec9_12 test_sec9_13)
 
 include_directories(SYSTEM ${CMOCKA_INCLUDE_DIR})