Radek Krejci | 2c22f12 | 2018-09-05 15:08:03 +0200 | [diff] [blame] | 1 | cmake_minimum_required(VERSION 2.8.12) |
| 2 | project(libyang C) |
| 3 | |
| 4 | include(GNUInstallDirs) |
| 5 | include(CheckSymbolExists) |
| 6 | |
| 7 | set(LIBYANG_DESCRIPTION "libyang is YANG data modelling language parser and toolkit written (and providing API) in C.") |
| 8 | |
| 9 | # Correct RPATH usage on OS X |
| 10 | set(CMAKE_MACOSX_RPATH TRUE) |
| 11 | |
| 12 | # set version |
| 13 | set(LIBYANG_MAJOR_VERSION 1) |
| 14 | set(LIBYANG_MINOR_VERSION 0) |
| 15 | set(LIBYANG_MICRO_VERSION 0) |
| 16 | set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_MICRO_VERSION}) |
| 17 | set(LIBYANG_SOVERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}) |
| 18 | |
| 19 | # set default build type if not specified by user |
| 20 | if(NOT CMAKE_BUILD_TYPE) |
| 21 | set(CMAKE_BUILD_TYPE debug) |
| 22 | endif() |
| 23 | |
Radek Krejci | e84f12f | 2018-09-18 14:11:50 +0200 | [diff] [blame] | 24 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -std=c99") |
Radek Krejci | 2c22f12 | 2018-09-05 15:08:03 +0200 | [diff] [blame] | 25 | set(CMAKE_C_FLAGS_RELEASE "-O2 -DNDEBUG") |
| 26 | set(CMAKE_C_FLAGS_PACKAGE "-g -O2 -DNDEBUG") |
| 27 | set(CMAKE_C_FLAGS_DEBUG "-g -O0") |
| 28 | |
| 29 | # options |
Radek Krejci | e84f12f | 2018-09-18 14:11:50 +0200 | [diff] [blame] | 30 | if((CMAKE_BUILD_TYPE STREQUAL debug) OR (CMAKE_BUILD_TYPE STREQUAL Package)) |
| 31 | option(ENABLE_BUILD_TESTS "Build tests" ON) |
| 32 | option(ENABLE_VALGRIND_TESTS "Build tests with valgrind" ON) |
| 33 | else() |
| 34 | option(ENABLE_BUILD_TESTS "Build tests" OFF) |
| 35 | option(ENABLE_VALGRIND_TESTS "Build tests with valgrind" OFF) |
| 36 | endif() |
Radek Krejci | 2c22f12 | 2018-09-05 15:08:03 +0200 | [diff] [blame] | 37 | #option(ENABLE_CALLGRIND_TESTS "Build performance tests to be run with callgrind" OFF) |
| 38 | |
| 39 | #option(ENABLE_CACHE "Enable data caching for schemas and hash tables for data (time-efficient at the cost of increased space-complexity)" ON) |
| 40 | #option(ENABLE_LATEST_REVISIONS "Enable reusing of latest revisions of schemas" ON) |
| 41 | #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) |
| 42 | #set(PLUGINS_DIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/libyang" CACHE STRING "Directory with libyang plugins (extensions and user types)") |
| 43 | |
| 44 | #if(ENABLE_CACHE) |
| 45 | # set(LY_ENABLED_CACHE 1) |
| 46 | #endif() |
| 47 | #if(ENABLE_LATEST_REVISIONS) |
| 48 | # set(LY_ENABLED_LATEST_REVISIONS 1) |
| 49 | #endif() |
| 50 | #if(ENABLE_LYD_PRIV) |
| 51 | # set(LY_ENABLED_LYD_PRIV 1) |
| 52 | #endif() |
| 53 | |
| 54 | if(CMAKE_C_COMPILER_ID STREQUAL "GNU") |
| 55 | set(COMPILER_UNUSED_ATTR "UNUSED_ ## x __attribute__((__unused__))") |
| 56 | set(COMPILER_PACKED_ATTR "__attribute__((__packed__))") |
| 57 | elseif(CMAKE_C_COMPILER_ID STREQUAL "Clang") |
| 58 | set(COMPILER_UNUSED_ATTR "UNUSED_ ## x __attribute__((__unused__))") |
| 59 | set(COMPILER_PACKED_ATTR "__attribute__((__packed__))") |
| 60 | else() |
| 61 | set(COMPILER_UNUSED_ATTR "UNUSED_ ## x") |
| 62 | set(COMPILER_PACKED_ATTR "") |
| 63 | endif() |
| 64 | |
| 65 | include_directories(${PROJECT_BINARY_DIR}/src ${PROJECT_SOURCE_DIR}/src) |
| 66 | configure_file(${PROJECT_SOURCE_DIR}/src/config.h.in ${PROJECT_BINARY_DIR}/src/config.h @ONLY) |
| 67 | |
| 68 | #set(EXTENSIONS_PLUGINS_DIR_MACRO "${PLUGINS_DIR}/extensions") |
| 69 | #set(USER_TYPES_PLUGINS_DIR_MACRO "${PLUGINS_DIR}/user_types") |
| 70 | |
| 71 | # include custom Modules |
| 72 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/CMakeModules/") |
| 73 | |
| 74 | # setup bindings |
| 75 | #set(GEN_LANGUAGE_BINDINGS 0 CACHE BOOL "Enable language bindings generation.") |
| 76 | #set(GEN_CPP_BINDINGS 1 CACHE BOOL "Enable C++ bindings.") |
| 77 | # Python bindings depend on C++ bindings because of SWIG |
| 78 | #set(GEN_PYTHON_BINDINGS 1 CACHE BOOL "Enable Python bindings.") |
| 79 | #set(GEN_PYTHON_VERSION "3" CACHE STRING "Python version") |
| 80 | #set(GEN_JAVASCRIPT_BINDINGS 0 CACHE BOOL "Enable JavaScript bindings.") |
| 81 | |
| 82 | #find_program(DEB_BUILDER NAMES debuild) |
| 83 | #find_program(RPM_BUILDER NAMES rpmbuild) |
| 84 | |
| 85 | #if (NOT DEFINED ENV{TRAVIS_BRANCH}) |
| 86 | # execute_process(COMMAND "git" "rev-parse" "--abbrev-ref" "HEAD" |
| 87 | # OUTPUT_VARIABLE GIT_BRANCH |
| 88 | # OUTPUT_STRIP_TRAILING_WHITESPACE |
| 89 | # ERROR_QUIET |
| 90 | # ) |
| 91 | # if (NOT GIT_BRANCH) |
| 92 | # set(ENV{TRAVIS_BRANCH} "master") |
| 93 | # else() |
| 94 | # if (GIT_BRANCH MATCHES "master|devel") |
| 95 | # set(ENV{TRAVIS_BRANCH} ${GIT_BRANCH}) |
| 96 | # else() |
| 97 | # set(ENV{TRAVIS_BRANCH} "master") |
| 98 | # endif() |
| 99 | # endif() |
| 100 | # set(GIT_BRANCH $ENV{TRAVIS_BRANCH}) |
| 101 | #endif() |
| 102 | # |
| 103 | #if ($ENV{TRAVIS_BRANCH} STREQUAL "master") |
| 104 | # set(PACKAGE_NAME "libyang") |
| 105 | # set(PACKAGE_PART_NAME "") |
| 106 | # set(BRANCH "master") |
| 107 | # set(BUILD_TYPE "Package") |
| 108 | # set(CONFLICT_PACKAGE_NAME "libyang-experimental") |
| 109 | #else () |
| 110 | # set(PACKAGE_NAME "libyang-experimental") |
| 111 | # set(PACKAGE_PART_NAME "-experimental") |
| 112 | # set(BRANCH "devel") |
| 113 | # set(BUILD_TYPE "debug") |
| 114 | # set(CONFLICT_PACKAGE_NAME "libyang") |
| 115 | #endif() |
| 116 | # change version in config files |
| 117 | #configure_file(${PROJECT_SOURCE_DIR}/packages/libyang.spec.in ${PROJECT_BINARY_DIR}/build-packages/libyang.spec) |
| 118 | #configure_file(${PROJECT_SOURCE_DIR}/packages/libyang.dsc.in ${PROJECT_BINARY_DIR}/build-packages/libyang.dsc) |
| 119 | #configure_file(${PROJECT_SOURCE_DIR}/packages/debian.control.in ${PROJECT_BINARY_DIR}/build-packages/debian.control @ONLY) |
| 120 | #configure_file(${PROJECT_SOURCE_DIR}/packages/debian.rules.in ${PROJECT_BINARY_DIR}/build-packages/debian.rules) |
| 121 | |
| 122 | #if (NOT DEB_BUILDER) |
| 123 | # 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.") |
| 124 | #else () |
| 125 | # # target for local build deb package |
| 126 | # add_custom_target(build-deb |
| 127 | # WORKING_DIRECTORY ${PROJECT_BINARY_DIR} |
| 128 | # COMMAND build-packages/local-deb.sh |
| 129 | # ) |
| 130 | # configure_file(${PROJECT_SOURCE_DIR}/packages/local-deb.sh.in ${PROJECT_BINARY_DIR}/build-packages/local-deb.sh @ONLY) |
| 131 | #endif() |
| 132 | |
| 133 | #if (NOT RPM_BUILDER) |
| 134 | # 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.") |
| 135 | #else () |
| 136 | # # target for local build rpm package |
| 137 | # string(REPLACE ${PROJECT_SOURCE_DIR} "." EXCLUDE_BUILD_DIR ${PROJECT_BINARY_DIR}) |
| 138 | # add_custom_target(build-rpm |
| 139 | # WORKING_DIRECTORY ${PROJECT_BINARY_DIR} |
| 140 | # COMMAND build-packages/local-rpm.sh |
| 141 | # ) |
| 142 | # configure_file(${PROJECT_SOURCE_DIR}/packages/local-rpm.sh.in ${PROJECT_BINARY_DIR}/build-packages/local-rpm.sh @ONLY) |
| 143 | #endif() |
| 144 | |
| 145 | # by default build shared library |
| 146 | # static build requires static libpcre library |
| 147 | option(ENABLE_STATIC "Build static (.a) library" OFF) |
| 148 | |
| 149 | # check the supported platform |
| 150 | if(NOT UNIX) |
| 151 | message(FATAL_ERROR "Only *nix like systems are supported.") |
| 152 | endif() |
| 153 | |
| 154 | set(libsrc |
Michal Vasko | 1324b6c | 2018-09-07 11:16:23 +0200 | [diff] [blame] | 155 | src/common.c |
Radek Krejci | 2c22f12 | 2018-09-05 15:08:03 +0200 | [diff] [blame] | 156 | src/log.c |
| 157 | src/hash_table.c |
Radek Krejci | ad57350 | 2018-09-07 15:26:55 +0200 | [diff] [blame] | 158 | src/set.c |
Radek Krejci | d4557c6 | 2018-09-17 11:42:09 +0200 | [diff] [blame] | 159 | src/context.c |
Radek Krejci | 3f5e3db | 2018-10-11 15:57:47 +0200 | [diff] [blame] | 160 | src/tree_schema.c |
Radek Krejci | 86d106e | 2018-10-18 09:53:19 +0200 | [diff] [blame] | 161 | src/tree_schema_helpers.c |
Radek Krejci | d91dbaf | 2018-09-21 15:51:39 +0200 | [diff] [blame] | 162 | src/parser_yang.c |
Radek Krejci | b1646a9 | 2018-11-02 16:08:26 +0100 | [diff] [blame^] | 163 | src/xml.c |
| 164 | src/xpath.c) |
Radek Krejci | 2c22f12 | 2018-09-05 15:08:03 +0200 | [diff] [blame] | 165 | |
| 166 | #set(lintsrc |
| 167 | # tools/lint/main.c |
| 168 | # tools/lint/main_ni.c |
| 169 | # tools/lint/commands.c |
| 170 | # tools/lint/completion.c |
| 171 | # tools/lint/configuration.c |
| 172 | # linenoise/linenoise.c) |
| 173 | |
| 174 | #set(resrc |
| 175 | # tools/re/main.c) |
| 176 | |
| 177 | #set(yang2yinsrc |
| 178 | # tools/yang2yin/main.c) |
| 179 | |
| 180 | set(headers |
| 181 | src/libyang.h |
Radek Krejci | 6caa6ab | 2018-10-24 10:04:48 +0200 | [diff] [blame] | 182 | src/context.h |
Radek Krejci | 2c22f12 | 2018-09-05 15:08:03 +0200 | [diff] [blame] | 183 | src/tree_schema.h |
Radek Krejci | ce8c159 | 2018-10-29 15:35:51 +0100 | [diff] [blame] | 184 | src/extensions.h |
Radek Krejci | 2c22f12 | 2018-09-05 15:08:03 +0200 | [diff] [blame] | 185 | src/dict.h |
| 186 | src/log.h |
Michal Vasko | 1324b6c | 2018-09-07 11:16:23 +0200 | [diff] [blame] | 187 | src/set.h) |
Radek Krejci | 2c22f12 | 2018-09-05 15:08:03 +0200 | [diff] [blame] | 188 | |
| 189 | check_symbol_exists(vdprintf stdio.h HAVE_VDPRINTF) |
| 190 | if(HAVE_VDPRINTF) |
| 191 | add_definitions(-DHAVE_VDPRINTF) |
| 192 | endif(HAVE_VDPRINTF) |
| 193 | |
| 194 | # create static libyang library |
| 195 | if(ENABLE_STATIC) |
| 196 | add_definitions(-DSTATIC) |
| 197 | set(CMAKE_EXE_LINKER_FLAGS -static) |
| 198 | set(CMAKE_FIND_LIBRARY_SUFFIXES .a) |
| 199 | set(CMAKE_EXE_LINK_DYNAMIC_C_FLAGS) # remove -Wl,-Bdynamic |
| 200 | set(CMAKE_EXE_LINK_DYNAMIC_CXX_FLAGS) |
| 201 | add_library(yang STATIC ${libsrc}) |
| 202 | else() |
| 203 | set(CMAKE_POSITION_INDEPENDENT_CODE TRUE) |
| 204 | add_library(yangobj OBJECT ${libsrc}) |
| 205 | add_library(yang SHARED $<TARGET_OBJECTS:yangobj>) |
| 206 | |
| 207 | #link dl |
| 208 | target_link_libraries(yang ${CMAKE_DL_LIBS}) |
| 209 | endif(ENABLE_STATIC) |
| 210 | |
| 211 | set_target_properties(yang PROPERTIES VERSION ${LIBYANG_VERSION} SOVERSION ${LIBYANG_SOVERSION}) |
| 212 | set_target_properties(yang PROPERTIES COMPILE_FLAGS "-fvisibility=hidden") |
| 213 | |
| 214 | # link math |
| 215 | target_link_libraries(yang m) |
| 216 | |
| 217 | # find pthreads |
| 218 | set(CMAKE_THREAD_PREFER_PTHREAD TRUE) |
| 219 | find_package(Threads REQUIRED) |
| 220 | if(ENABLE_STATIC) |
| 221 | target_link_libraries(yang -Wl,--whole-archive ${CMAKE_THREAD_LIBS_INIT} -Wl,--no-whole-archive) |
| 222 | else() |
| 223 | target_link_libraries(yang ${CMAKE_THREAD_LIBS_INIT}) |
| 224 | endif(ENABLE_STATIC) |
| 225 | |
| 226 | # find PCRE library |
| 227 | unset(PCRE_LIBRARY CACHE) |
| 228 | find_package(PCRE REQUIRED) |
| 229 | include_directories(${PCRE_INCLUDE_DIRS}) |
| 230 | target_link_libraries(yang ${PCRE_LIBRARIES}) |
| 231 | |
| 232 | install(TARGETS yang DESTINATION ${CMAKE_INSTALL_LIBDIR}) |
| 233 | install(FILES ${headers} ${PROJECT_BINARY_DIR}/src/config.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libyang) |
| 234 | |
| 235 | find_package(PkgConfig) |
| 236 | if(PKG_CONFIG_FOUND) |
| 237 | # generate and install pkg-config file |
| 238 | configure_file("libyang.pc.in" "libyang.pc" @ONLY) |
| 239 | install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libyang.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") |
| 240 | # check that pkg-config includes the used path |
| 241 | execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} --variable pc_path pkg-config RESULT_VARIABLE RETURN OUTPUT_VARIABLE PC_PATH ERROR_QUIET) |
| 242 | if(RETURN EQUAL 0) |
| 243 | string(STRIP "${PC_PATH}" PC_PATH) |
| 244 | set(PC_PATH "${PC_PATH}:$ENV{PKG_CONFIG_PATH}") |
| 245 | string(REGEX MATCH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/pkgconfig" SUBSTR "${PC_PATH}") |
| 246 | string(LENGTH "${SUBSTR}" SUBSTR_LEN) |
| 247 | if(SUBSTR_LEN EQUAL 0) |
| 248 | 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\".") |
| 249 | endif() |
| 250 | endif() |
| 251 | endif() |
| 252 | |
| 253 | # generate doxygen documentation for libyang API |
| 254 | find_package(Doxygen) |
| 255 | if(DOXYGEN_FOUND) |
| 256 | find_program(DOT_PATH dot PATH_SUFFIXES graphviz2.38/bin graphviz/bin) |
| 257 | if(DOT_PATH) |
| 258 | set(HAVE_DOT "YES") |
| 259 | else() |
| 260 | set(HAVE_DOT "NO") |
| 261 | message(AUTHOR_WARNING "Doxygen: to generate UML diagrams please install graphviz") |
| 262 | endif() |
| 263 | add_custom_target(doc |
| 264 | COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_BINARY_DIR}/Doxyfile |
| 265 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) |
| 266 | configure_file(Doxyfile.in Doxyfile) |
| 267 | endif() |
| 268 | |
| 269 | # clean cmake cache |
| 270 | add_custom_target(cclean |
| 271 | COMMAND make clean |
| 272 | COMMAND find . -iname '*cmake*' -not -name CMakeLists.txt -not -path './CMakeModules*' -exec rm -rf {} + |
| 273 | COMMAND rm -rf Makefile Doxyfile |
| 274 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) |
| 275 | |
| 276 | # YANG extensions plugins |
| 277 | #set(EXTENSIONS_LIST "nacm" "metadata" "yangdata") |
| 278 | # if the tests are enabled, build libyang_ext_test |
Radek Krejci | e84f12f | 2018-09-18 14:11:50 +0200 | [diff] [blame] | 279 | if(ENABLE_BUILD_TESTS) |
| 280 | find_package(CMocka 1.0.0) |
Radek Krejci | 2c22f12 | 2018-09-05 15:08:03 +0200 | [diff] [blame] | 281 | # if(CMOCKA_FOUND AND CMAKE_BUILD_TYPE MATCHES debug) |
| 282 | # list(APPEND EXTENSIONS_LIST "libyang_ext_test") |
| 283 | # endif(CMOCKA_FOUND AND CMAKE_BUILD_TYPE MATCHES debug) |
Radek Krejci | e84f12f | 2018-09-18 14:11:50 +0200 | [diff] [blame] | 284 | endif(ENABLE_BUILD_TESTS) |
Radek Krejci | 2c22f12 | 2018-09-05 15:08:03 +0200 | [diff] [blame] | 285 | |
| 286 | #if(ENABLE_STATIC) |
| 287 | # set(EXTENSIONS_LIST_SIZE " 0 ") |
| 288 | # set(ITEM 0) |
| 289 | # foreach(EXTENSION ${EXTENSIONS_LIST}) |
| 290 | # add_library(${EXTENSION} STATIC "src/extensions/${EXTENSION}.c") |
| 291 | # target_link_libraries(yang ${EXTENSION}) |
| 292 | # set(EXTENSIONS_LIST_SIZE "${EXTENSIONS_LIST_SIZE} + lyext_size(${EXTENSION})") |
| 293 | # set(EXTERN_EXTENSIONS_LIST "${EXTERN_EXTENSIONS_LIST}extern struct lyext_plugin_list ${EXTENSION}[];\n") |
| 294 | # set(MEMCPY_EXTENSIONS_LIST "${MEMCPY_EXTENSIONS_LIST} lyext_add(plugin, count, ${EXTENSION});\n") |
| 295 | # set(STATIC_LOADED_PLUGINS "${STATIC_LOADED_PLUGINS} \"${EXTENSION}\",") |
| 296 | # MATH(EXPR ITEM "${ITEM}+1") |
| 297 | # endforeach() |
| 298 | #else() |
| 299 | # add_subdirectory(src/extensions) |
| 300 | #endif(ENABLE_STATIC) |
| 301 | |
| 302 | # YANG user types plugins ("user_ipv4" is just an example, not installed by default) |
| 303 | #set(USER_TYPE_LIST "user_date_and_time") |
| 304 | #if(ENABLE_STATIC) |
| 305 | # set(USER_TYPE_LIST_SIZE " 0 ") |
| 306 | # foreach(USER_TYPE ${USER_TYPE_LIST}) |
| 307 | # add_library(${USER_TYPE} STATIC "src/user_types/${USER_TYPE}.c") |
| 308 | # target_link_libraries(yang ${USER_TYPE}) |
| 309 | # set(USER_TYPE_LIST_SIZE "${USER_TYPE_LIST_SIZE} + lytype_size(${USER_TYPE})") |
| 310 | # set(EXTERN_USER_TYPE_LIST "${EXTERN_USER_TYPE_LIST}extern struct lytype_plugin_list ${USER_TYPE}[];\n") |
| 311 | # set(MEMCPY_USER_TYPE_LIST "${MEMCPY_USER_TYPE_LIST} lytype_add(plugin, count, ${USER_TYPE});\n") |
| 312 | # set(STATIC_LOADED_PLUGINS "${STATIC_LOADED_PLUGINS} \"${USER_TYPE}\",") |
| 313 | # MATH(EXPR ITEM "${ITEM}+1") |
| 314 | # endforeach() |
| 315 | # set(STATIC_LOADED_PLUGINS_COUNT "${ITEM}") |
| 316 | #else() |
| 317 | # add_subdirectory(src/user_types) |
| 318 | #endif(ENABLE_STATIC) |
| 319 | # |
| 320 | #configure_file(${PROJECT_SOURCE_DIR}/src/plugin_config.h.in ${PROJECT_BINARY_DIR}/src/plugin_config.h) |
| 321 | |
| 322 | # yanglint |
| 323 | #add_executable(yanglint ${lintsrc}) |
| 324 | #target_link_libraries(yanglint yang) |
| 325 | #install(TARGETS yanglint DESTINATION ${CMAKE_INSTALL_BINDIR}) |
| 326 | #install(FILES ${PROJECT_SOURCE_DIR}/tools/lint/yanglint.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1) |
| 327 | |
| 328 | #yangre |
| 329 | #add_executable(yangre ${resrc}) |
| 330 | #target_link_libraries(yangre yang) |
| 331 | #install(TARGETS yangre DESTINATION ${CMAKE_INSTALL_BINDIR}) |
| 332 | |
| 333 | # yang2yin |
| 334 | #add_executable(yang2yin ${yang2yinsrc}) |
| 335 | |
Radek Krejci | e84f12f | 2018-09-18 14:11:50 +0200 | [diff] [blame] | 336 | if(ENABLE_VALGRIND_TESTS) |
| 337 | set(ENABLE_BUILD_TESTS ON) |
| 338 | endif() |
Radek Krejci | 2c22f12 | 2018-09-05 15:08:03 +0200 | [diff] [blame] | 339 | |
Radek Krejci | e84f12f | 2018-09-18 14:11:50 +0200 | [diff] [blame] | 340 | if(ENABLE_BUILD_TESTS) |
| 341 | if(CMOCKA_FOUND) |
| 342 | enable_testing() |
| 343 | add_subdirectory(tests) |
| 344 | else(CMOCKA_FOUND) |
| 345 | message(STATUS "Disabling tests because of missing CMocka") |
| 346 | set(ENABLE_BUILD_TESTS NO) |
| 347 | endif(CMOCKA_FOUND) |
| 348 | endif(ENABLE_BUILD_TESTS) |
Radek Krejci | 2c22f12 | 2018-09-05 15:08:03 +0200 | [diff] [blame] | 349 | |
| 350 | #if(GEN_LANGUAGE_BINDINGS AND GEN_CPP_BINDINGS) |
| 351 | # add_subdirectory(swig) |
| 352 | #endif() |
| 353 | |