blob: 2ffa4b707cdba5ae482d00359d10a294bce73971 [file] [log] [blame]
Radek Krejci2c22f122018-09-05 15:08:03 +02001cmake_minimum_required(VERSION 2.8.12)
Radek Krejcif8482c72019-04-04 10:10:47 +02002
3# force out-of-source build
4if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
5 message(FATAL_ERROR "In-source build is not allowed. Please make a standalone build directory and run CMake from there. You may need to remove CMakeCache.txt.")
6endif()
7
Radek Krejci2c22f122018-09-05 15:08:03 +02008project(libyang C)
9
10include(GNUInstallDirs)
11include(CheckSymbolExists)
12
13set(LIBYANG_DESCRIPTION "libyang is YANG data modelling language parser and toolkit written (and providing API) in C.")
14
15# Correct RPATH usage on OS X
16set(CMAKE_MACOSX_RPATH TRUE)
17
Radek Krejcia43d69d2019-04-04 10:34:46 +020018# set version of the project
19set(LIBYANG_MAJOR_VERSION 2)
Radek Krejci2c22f122018-09-05 15:08:03 +020020set(LIBYANG_MINOR_VERSION 0)
21set(LIBYANG_MICRO_VERSION 0)
22set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_MICRO_VERSION})
Radek Krejcia43d69d2019-04-04 10:34:46 +020023# set version of the library
24set(LIBYANG_MAJOR_SOVERSION 2)
25set(LIBYANG_MINOR_SOVERSION 0)
26set(LIBYANG_MICRO_SOVERSION 0)
27set(LIBYANG_SOVERSION_FULL ${LIBYANG_MAJOR_SOVERSION}.${LIBYANG_MINOR_SOVERSION}.${LIBYANG_MICRO_SOVERSION})
28set(LIBYANG_SOVERSION ${LIBYANG_MAJOR_SOVERSION})
Radek Krejci2c22f122018-09-05 15:08:03 +020029
30# set default build type if not specified by user
31if(NOT CMAKE_BUILD_TYPE)
32 set(CMAKE_BUILD_TYPE debug)
33endif()
34
Radek Krejcicad716e2018-11-26 15:18:27 +010035set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wno-missing-field-initializers -std=c99")
Radek Krejci2c22f122018-09-05 15:08:03 +020036set(CMAKE_C_FLAGS_RELEASE "-O2 -DNDEBUG")
37set(CMAKE_C_FLAGS_PACKAGE "-g -O2 -DNDEBUG")
38set(CMAKE_C_FLAGS_DEBUG "-g -O0")
39
40# options
Radek Krejcie84f12f2018-09-18 14:11:50 +020041if((CMAKE_BUILD_TYPE STREQUAL debug) OR (CMAKE_BUILD_TYPE STREQUAL Package))
42 option(ENABLE_BUILD_TESTS "Build tests" ON)
43 option(ENABLE_VALGRIND_TESTS "Build tests with valgrind" ON)
Radek Krejcie8fb7dd2019-03-08 15:14:38 +010044
45 if(CMAKE_COMPILER_IS_GNUCC)
46 option(ENABLE_COVERAGE "Build code coverage report from tests" ON)
47 else()
48 option(ENABLE_COVERAGE "Build code coverage report from tests" OFF)
49 endif()
Radek Krejcie84f12f2018-09-18 14:11:50 +020050else()
51 option(ENABLE_BUILD_TESTS "Build tests" OFF)
52 option(ENABLE_VALGRIND_TESTS "Build tests with valgrind" OFF)
Radek Krejci6208cfa2019-03-08 14:43:58 +010053 option(ENABLE_COVERAGE "Build code coverage report from tests" OFF)
Radek Krejcie84f12f2018-09-18 14:11:50 +020054endif()
Radek Krejci2c22f122018-09-05 15:08:03 +020055#option(ENABLE_CALLGRIND_TESTS "Build performance tests to be run with callgrind" OFF)
56
57#option(ENABLE_CACHE "Enable data caching for schemas and hash tables for data (time-efficient at the cost of increased space-complexity)" ON)
58#option(ENABLE_LATEST_REVISIONS "Enable reusing of latest revisions of schemas" ON)
59#option(ENABLE_LYD_PRIV "Add a private pointer also to struct lyd_node (data node structure), just like in struct lys_node, for arbitrary user data" OFF)
60#set(PLUGINS_DIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/libyang" CACHE STRING "Directory with libyang plugins (extensions and user types)")
61
62#if(ENABLE_CACHE)
63# set(LY_ENABLED_CACHE 1)
64#endif()
65#if(ENABLE_LATEST_REVISIONS)
66# set(LY_ENABLED_LATEST_REVISIONS 1)
67#endif()
68#if(ENABLE_LYD_PRIV)
69# set(LY_ENABLED_LYD_PRIV 1)
70#endif()
71
72if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
73 set(COMPILER_UNUSED_ATTR "UNUSED_ ## x __attribute__((__unused__))")
74 set(COMPILER_PACKED_ATTR "__attribute__((__packed__))")
75elseif(CMAKE_C_COMPILER_ID STREQUAL "Clang")
76 set(COMPILER_UNUSED_ATTR "UNUSED_ ## x __attribute__((__unused__))")
77 set(COMPILER_PACKED_ATTR "__attribute__((__packed__))")
78else()
79 set(COMPILER_UNUSED_ATTR "UNUSED_ ## x")
80 set(COMPILER_PACKED_ATTR "")
81endif()
82
Radek Krejcia9dc4ab2019-05-16 11:13:17 +020083list(APPEND CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
84check_symbol_exists(get_current_dir_name unistd.h HAVE_GET_CURRENT_DIR_NAME)
85check_symbol_exists(vdprintf stdio.h HAVE_VDPRINTF)
86check_symbol_exists(strnstr string.h HAVE_STRNSTR)
87
Radek Krejci2c22f122018-09-05 15:08:03 +020088include_directories(${PROJECT_BINARY_DIR}/src ${PROJECT_SOURCE_DIR}/src)
89configure_file(${PROJECT_SOURCE_DIR}/src/config.h.in ${PROJECT_BINARY_DIR}/src/config.h @ONLY)
90
91#set(EXTENSIONS_PLUGINS_DIR_MACRO "${PLUGINS_DIR}/extensions")
92#set(USER_TYPES_PLUGINS_DIR_MACRO "${PLUGINS_DIR}/user_types")
93
94# include custom Modules
95set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/CMakeModules/")
96
97# setup bindings
98#set(GEN_LANGUAGE_BINDINGS 0 CACHE BOOL "Enable language bindings generation.")
99#set(GEN_CPP_BINDINGS 1 CACHE BOOL "Enable C++ bindings.")
100# Python bindings depend on C++ bindings because of SWIG
101#set(GEN_PYTHON_BINDINGS 1 CACHE BOOL "Enable Python bindings.")
102#set(GEN_PYTHON_VERSION "3" CACHE STRING "Python version")
103#set(GEN_JAVASCRIPT_BINDINGS 0 CACHE BOOL "Enable JavaScript bindings.")
104
105#find_program(DEB_BUILDER NAMES debuild)
106#find_program(RPM_BUILDER NAMES rpmbuild)
107
108#if (NOT DEFINED ENV{TRAVIS_BRANCH})
109# execute_process(COMMAND "git" "rev-parse" "--abbrev-ref" "HEAD"
110# OUTPUT_VARIABLE GIT_BRANCH
111# OUTPUT_STRIP_TRAILING_WHITESPACE
112# ERROR_QUIET
113# )
114# if (NOT GIT_BRANCH)
115# set(ENV{TRAVIS_BRANCH} "master")
116# else()
117# if (GIT_BRANCH MATCHES "master|devel")
118# set(ENV{TRAVIS_BRANCH} ${GIT_BRANCH})
119# else()
120# set(ENV{TRAVIS_BRANCH} "master")
121# endif()
122# endif()
123# set(GIT_BRANCH $ENV{TRAVIS_BRANCH})
124#endif()
125#
126#if ($ENV{TRAVIS_BRANCH} STREQUAL "master")
127# set(PACKAGE_NAME "libyang")
128# set(PACKAGE_PART_NAME "")
129# set(BRANCH "master")
130# set(BUILD_TYPE "Package")
131# set(CONFLICT_PACKAGE_NAME "libyang-experimental")
132#else ()
133# set(PACKAGE_NAME "libyang-experimental")
134# set(PACKAGE_PART_NAME "-experimental")
135# set(BRANCH "devel")
136# set(BUILD_TYPE "debug")
137# set(CONFLICT_PACKAGE_NAME "libyang")
138#endif()
139# change version in config files
140#configure_file(${PROJECT_SOURCE_DIR}/packages/libyang.spec.in ${PROJECT_BINARY_DIR}/build-packages/libyang.spec)
141#configure_file(${PROJECT_SOURCE_DIR}/packages/libyang.dsc.in ${PROJECT_BINARY_DIR}/build-packages/libyang.dsc)
142#configure_file(${PROJECT_SOURCE_DIR}/packages/debian.control.in ${PROJECT_BINARY_DIR}/build-packages/debian.control @ONLY)
143#configure_file(${PROJECT_SOURCE_DIR}/packages/debian.rules.in ${PROJECT_BINARY_DIR}/build-packages/debian.rules)
144
145#if (NOT DEB_BUILDER)
146# message(WARNING "Missing tools (devscripts, debhelper package) for building deb package.\nYou won't be able to generate deb package from source code.\nCompiling libyang should still works fine.")
147#else ()
148# # target for local build deb package
149# add_custom_target(build-deb
150# WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
151# COMMAND build-packages/local-deb.sh
152# )
153# configure_file(${PROJECT_SOURCE_DIR}/packages/local-deb.sh.in ${PROJECT_BINARY_DIR}/build-packages/local-deb.sh @ONLY)
154#endif()
155
156#if (NOT RPM_BUILDER)
157# message(WARNING "Missing tools (rpm package) for building rpm package. \nYou won't be able to generate rpm package from source code.\nCompiling libyang should still works fine.")
158#else ()
159# # target for local build rpm package
160# string(REPLACE ${PROJECT_SOURCE_DIR} "." EXCLUDE_BUILD_DIR ${PROJECT_BINARY_DIR})
161# add_custom_target(build-rpm
162# WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
163# COMMAND build-packages/local-rpm.sh
164# )
165# configure_file(${PROJECT_SOURCE_DIR}/packages/local-rpm.sh.in ${PROJECT_BINARY_DIR}/build-packages/local-rpm.sh @ONLY)
166#endif()
167
168# by default build shared library
Radek Krejci54579462019-04-30 12:47:06 +0200169# static build requires static libpcre2 library
Radek Krejci2c22f122018-09-05 15:08:03 +0200170option(ENABLE_STATIC "Build static (.a) library" OFF)
171
172# check the supported platform
173if(NOT UNIX)
174 message(FATAL_ERROR "Only *nix like systems are supported.")
175endif()
176
177set(libsrc
Michal Vasko1324b6c2018-09-07 11:16:23 +0200178 src/common.c
Radek Krejcie7b95092019-05-15 11:03:07 +0200179 src/compat.c
Radek Krejci2c22f122018-09-05 15:08:03 +0200180 src/log.c
181 src/hash_table.c
Radek Krejciad573502018-09-07 15:26:55 +0200182 src/set.c
Radek Krejcid4557c62018-09-17 11:42:09 +0200183 src/context.c
Radek Krejcie7b95092019-05-15 11:03:07 +0200184 src/tree_data.c
185 src/tree_data_free.c
186 src/tree_data_helpers.c
187 src/tree_data_hash.c
188 src/parser_xml.c
189 src/printer_data.c
190 src/printer_xml.c
Radek Krejci3f5e3db2018-10-11 15:57:47 +0200191 src/tree_schema.c
Radek Krejci19a96102018-11-15 13:38:09 +0100192 src/tree_schema_free.c
193 src/tree_schema_compile.c
Radek Krejci86d106e2018-10-18 09:53:19 +0200194 src/tree_schema_helpers.c
Radek Krejcid91dbaf2018-09-21 15:51:39 +0200195 src/parser_yang.c
Radek Krejcid3ca0632019-04-16 16:54:54 +0200196 src/printer.c
Radek Krejcie7b95092019-05-15 11:03:07 +0200197 src/printer_schema.c
Radek Krejcid3ca0632019-04-16 16:54:54 +0200198 src/printer_yang.c
Radek Krejcie7b95092019-05-15 11:03:07 +0200199 src/plugins_types.c
Radek Krejcib1646a92018-11-02 16:08:26 +0100200 src/xml.c
201 src/xpath.c)
Radek Krejci2c22f122018-09-05 15:08:03 +0200202
Radek Krejcied5acc52019-04-25 15:57:04 +0200203set(lintsrc
204 tools/lint/main.c
205 tools/lint/main_ni.c
206 tools/lint/commands.c
207 tools/lint/completion.c
208 tools/lint/configuration.c
209 tools/lint/linenoise/linenoise.c)
Radek Krejci2c22f122018-09-05 15:08:03 +0200210
211#set(resrc
212# tools/re/main.c)
213
Radek Krejci2c22f122018-09-05 15:08:03 +0200214set(headers
215 src/libyang.h
Radek Krejci6caa6ab2018-10-24 10:04:48 +0200216 src/context.h
Radek Krejcie7b95092019-05-15 11:03:07 +0200217 src/tree.h
218 src/tree_data.h
219 src/printer_data.h
Radek Krejci2c22f122018-09-05 15:08:03 +0200220 src/tree_schema.h
Radek Krejcid3ca0632019-04-16 16:54:54 +0200221 src/printer_schema.h
Radek Krejcice8c1592018-10-29 15:35:51 +0100222 src/extensions.h
Radek Krejcie7b95092019-05-15 11:03:07 +0200223 src/plugins_types.h
Radek Krejci2c22f122018-09-05 15:08:03 +0200224 src/dict.h
225 src/log.h
Michal Vasko1324b6c2018-09-07 11:16:23 +0200226 src/set.h)
Radek Krejci2c22f122018-09-05 15:08:03 +0200227
Radek Krejci2c22f122018-09-05 15:08:03 +0200228# create static libyang library
229if(ENABLE_STATIC)
230 add_definitions(-DSTATIC)
231 set(CMAKE_EXE_LINKER_FLAGS -static)
232 set(CMAKE_FIND_LIBRARY_SUFFIXES .a)
233 set(CMAKE_EXE_LINK_DYNAMIC_C_FLAGS) # remove -Wl,-Bdynamic
234 set(CMAKE_EXE_LINK_DYNAMIC_CXX_FLAGS)
235 add_library(yang STATIC ${libsrc})
236else()
237 set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
238 add_library(yangobj OBJECT ${libsrc})
239 add_library(yang SHARED $<TARGET_OBJECTS:yangobj>)
240
241 #link dl
242 target_link_libraries(yang ${CMAKE_DL_LIBS})
243endif(ENABLE_STATIC)
244
Radek Krejcia43d69d2019-04-04 10:34:46 +0200245set_target_properties(yang PROPERTIES VERSION ${LIBYANG_SOVERSION_FULL} SOVERSION ${LIBYANG_SOVERSION})
Radek Krejcif3f47842018-11-15 11:22:15 +0100246set_target_properties(yangobj PROPERTIES COMPILE_FLAGS "-fvisibility=hidden")
Radek Krejci2c22f122018-09-05 15:08:03 +0200247
248# link math
249target_link_libraries(yang m)
250
251# find pthreads
252set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
253find_package(Threads REQUIRED)
254if(ENABLE_STATIC)
255 target_link_libraries(yang -Wl,--whole-archive ${CMAKE_THREAD_LIBS_INIT} -Wl,--no-whole-archive)
256else()
257 target_link_libraries(yang ${CMAKE_THREAD_LIBS_INIT})
258endif(ENABLE_STATIC)
259
Radek Krejci54579462019-04-30 12:47:06 +0200260# find PCRE2 library
261unset(PCRE2_LIBRARY CACHE)
262find_package(PCRE2 REQUIRED)
263include_directories(${PCRE2_INCLUDE_DIRS})
264target_link_libraries(yang ${PCRE2_LIBRARIES})
Radek Krejci2c22f122018-09-05 15:08:03 +0200265
266install(TARGETS yang DESTINATION ${CMAKE_INSTALL_LIBDIR})
267install(FILES ${headers} ${PROJECT_BINARY_DIR}/src/config.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libyang)
268
269find_package(PkgConfig)
270if(PKG_CONFIG_FOUND)
271 # generate and install pkg-config file
272 configure_file("libyang.pc.in" "libyang.pc" @ONLY)
273 install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libyang.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
274 # check that pkg-config includes the used path
275 execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} --variable pc_path pkg-config RESULT_VARIABLE RETURN OUTPUT_VARIABLE PC_PATH ERROR_QUIET)
276 if(RETURN EQUAL 0)
277 string(STRIP "${PC_PATH}" PC_PATH)
278 set(PC_PATH "${PC_PATH}:$ENV{PKG_CONFIG_PATH}")
279 string(REGEX MATCH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/pkgconfig" SUBSTR "${PC_PATH}")
280 string(LENGTH "${SUBSTR}" SUBSTR_LEN)
281 if(SUBSTR_LEN EQUAL 0)
282 message(WARNING "pkg-config will not detect the new package after installation, adjust PKG_CONFIG_PATH using \"export PKG_CONFIG_PATH=\${PKG_CONFIG_PATH}:${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/pkgconfig\".")
283 endif()
284 endif()
285endif()
286
287# generate doxygen documentation for libyang API
288find_package(Doxygen)
289if(DOXYGEN_FOUND)
290 find_program(DOT_PATH dot PATH_SUFFIXES graphviz2.38/bin graphviz/bin)
291 if(DOT_PATH)
292 set(HAVE_DOT "YES")
293 else()
294 set(HAVE_DOT "NO")
295 message(AUTHOR_WARNING "Doxygen: to generate UML diagrams please install graphviz")
296 endif()
297 add_custom_target(doc
298 COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_BINARY_DIR}/Doxyfile
299 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
300 configure_file(Doxyfile.in Doxyfile)
301endif()
302
303# clean cmake cache
304add_custom_target(cclean
305 COMMAND make clean
306 COMMAND find . -iname '*cmake*' -not -name CMakeLists.txt -not -path './CMakeModules*' -exec rm -rf {} +
307 COMMAND rm -rf Makefile Doxyfile
308 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
309
310# YANG extensions plugins
311#set(EXTENSIONS_LIST "nacm" "metadata" "yangdata")
312# if the tests are enabled, build libyang_ext_test
Radek Krejcie84f12f2018-09-18 14:11:50 +0200313if(ENABLE_BUILD_TESTS)
314 find_package(CMocka 1.0.0)
Radek Krejci2c22f122018-09-05 15:08:03 +0200315# if(CMOCKA_FOUND AND CMAKE_BUILD_TYPE MATCHES debug)
316# list(APPEND EXTENSIONS_LIST "libyang_ext_test")
317# endif(CMOCKA_FOUND AND CMAKE_BUILD_TYPE MATCHES debug)
Radek Krejcie84f12f2018-09-18 14:11:50 +0200318endif(ENABLE_BUILD_TESTS)
Radek Krejci2c22f122018-09-05 15:08:03 +0200319
320#if(ENABLE_STATIC)
321# set(EXTENSIONS_LIST_SIZE " 0 ")
322# set(ITEM 0)
323# foreach(EXTENSION ${EXTENSIONS_LIST})
324# add_library(${EXTENSION} STATIC "src/extensions/${EXTENSION}.c")
325# target_link_libraries(yang ${EXTENSION})
326# set(EXTENSIONS_LIST_SIZE "${EXTENSIONS_LIST_SIZE} + lyext_size(${EXTENSION})")
327# set(EXTERN_EXTENSIONS_LIST "${EXTERN_EXTENSIONS_LIST}extern struct lyext_plugin_list ${EXTENSION}[];\n")
328# set(MEMCPY_EXTENSIONS_LIST "${MEMCPY_EXTENSIONS_LIST} lyext_add(plugin, count, ${EXTENSION});\n")
329# set(STATIC_LOADED_PLUGINS "${STATIC_LOADED_PLUGINS} \"${EXTENSION}\",")
330# MATH(EXPR ITEM "${ITEM}+1")
331# endforeach()
332#else()
333# add_subdirectory(src/extensions)
334#endif(ENABLE_STATIC)
335
336# YANG user types plugins ("user_ipv4" is just an example, not installed by default)
337#set(USER_TYPE_LIST "user_date_and_time")
338#if(ENABLE_STATIC)
339# set(USER_TYPE_LIST_SIZE " 0 ")
340# foreach(USER_TYPE ${USER_TYPE_LIST})
341# add_library(${USER_TYPE} STATIC "src/user_types/${USER_TYPE}.c")
342# target_link_libraries(yang ${USER_TYPE})
343# set(USER_TYPE_LIST_SIZE "${USER_TYPE_LIST_SIZE} + lytype_size(${USER_TYPE})")
344# set(EXTERN_USER_TYPE_LIST "${EXTERN_USER_TYPE_LIST}extern struct lytype_plugin_list ${USER_TYPE}[];\n")
345# set(MEMCPY_USER_TYPE_LIST "${MEMCPY_USER_TYPE_LIST} lytype_add(plugin, count, ${USER_TYPE});\n")
346# set(STATIC_LOADED_PLUGINS "${STATIC_LOADED_PLUGINS} \"${USER_TYPE}\",")
347# MATH(EXPR ITEM "${ITEM}+1")
348# endforeach()
349# set(STATIC_LOADED_PLUGINS_COUNT "${ITEM}")
350#else()
351# add_subdirectory(src/user_types)
352#endif(ENABLE_STATIC)
353#
354#configure_file(${PROJECT_SOURCE_DIR}/src/plugin_config.h.in ${PROJECT_BINARY_DIR}/src/plugin_config.h)
355
Radek Krejcied5acc52019-04-25 15:57:04 +0200356# config file for tools
357configure_file(${PROJECT_SOURCE_DIR}/tools/config.h.in ${PROJECT_BINARY_DIR}/tools/config.h @ONLY)
358
Radek Krejci2c22f122018-09-05 15:08:03 +0200359# yanglint
Radek Krejcied5acc52019-04-25 15:57:04 +0200360add_executable(yanglint ${lintsrc})
361target_link_libraries(yanglint yang)
362install(TARGETS yanglint DESTINATION ${CMAKE_INSTALL_BINDIR})
363install(FILES ${PROJECT_SOURCE_DIR}/tools/lint/yanglint.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
364target_include_directories(yanglint BEFORE PRIVATE ${PROJECT_BINARY_DIR}/tools)
Radek Krejci2c22f122018-09-05 15:08:03 +0200365
366#yangre
367#add_executable(yangre ${resrc})
368#target_link_libraries(yangre yang)
369#install(TARGETS yangre DESTINATION ${CMAKE_INSTALL_BINDIR})
Radek Krejcied5acc52019-04-25 15:57:04 +0200370#target_include_directories(yangre BEFORE PRIVATE ${PROJECT_BINARY_DIR}/tools)
Radek Krejci2c22f122018-09-05 15:08:03 +0200371
Radek Krejcie84f12f2018-09-18 14:11:50 +0200372if(ENABLE_VALGRIND_TESTS)
373 set(ENABLE_BUILD_TESTS ON)
374endif()
Radek Krejci2c22f122018-09-05 15:08:03 +0200375
Radek Krejcie84f12f2018-09-18 14:11:50 +0200376if(ENABLE_BUILD_TESTS)
377 if(CMOCKA_FOUND)
378 enable_testing()
379 add_subdirectory(tests)
380 else(CMOCKA_FOUND)
381 message(STATUS "Disabling tests because of missing CMocka")
382 set(ENABLE_BUILD_TESTS NO)
383 endif(CMOCKA_FOUND)
384endif(ENABLE_BUILD_TESTS)
Radek Krejci2c22f122018-09-05 15:08:03 +0200385
386#if(GEN_LANGUAGE_BINDINGS AND GEN_CPP_BINDINGS)
387# add_subdirectory(swig)
388#endif()
389