Skip to content

Commit

Permalink
build UPDATE use standard var for static build
Browse files Browse the repository at this point in the history
  • Loading branch information
michalvasko committed Feb 29, 2024
1 parent 659f8fa commit 703a610
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
9 changes: 3 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ option(ENABLE_PERF_TESTS "Build performance tests" OFF)
option(ENABLE_COVERAGE "Build code coverage report from tests" OFF)
option(ENABLE_FUZZ_TARGETS "Build target programs suitable for fuzzing with AFL" OFF)
option(ENABLE_INTERNAL_DOCS "Generate doxygen documentation also from internal headers" OFF)
option(BUILD_SHARED_LIBS "By default, shared libs are enabled. Turn off for a static build." ON)
set(YANG_MODULE_DIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATADIR}/yang/modules/libyang" CACHE STRING "Directory where to copy the YANG modules to")

if(ENABLE_INTERNAL_DOCS)
Expand All @@ -262,14 +263,10 @@ set(PLUGINS_DIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/libyang" CACHE
set(PLUGINS_DIR_EXTENSIONS "${PLUGINS_DIR}/extensions" CACHE STRING "Directory with libyang user extensions plugins")
set(PLUGINS_DIR_TYPES "${PLUGINS_DIR}/types" CACHE STRING "Directory with libyang user types plugins")

# by default build shared library
# static build requires static libpcre2 library
option(ENABLE_STATIC "Build static (.a) library" OFF)

#
# checks
#
if(ENABLE_STATIC)
if(NOT BUILD_SHARED_LIBS)
message(STATUS "Disabling tests for static build")
set(ENABLE_TESTS OFF)
set(ENABLE_VALGRIND_TESTS OFF)
Expand Down Expand Up @@ -341,7 +338,7 @@ endif()
use_compat()

# create static libyang library
if(ENABLE_STATIC)
if(NOT BUILD_SHARED_LIBS)
add_definitions(-DSTATIC)

# allow binaries compilation linking both static and dynamic libraries never linking static glibc
Expand Down
4 changes: 2 additions & 2 deletions doc/build.dox
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
* ENABLE_VALGRIND_TESTS | Build tests with valgrind. | OFF
* ENABLE_COVERAGE | Build code coverage report from tests. | OFF
* ENABLE_FUZZ_TARGETS | Build target programs suitable for fuzzing with AFL. | OFF
* ENABLE_STATIC | Build static (.a) library | OFF
* BUILD_SHARED_LIBS | Build shared (.so) instead of static (.a) library | ON
* INTERNAL_DOCS | Include developers notes and internal API description into generated Documentation | OFF
*
* Here is the list of available important targets for the `make(1)` tool:
Expand All @@ -85,7 +85,7 @@
* ENABLE_VALGRIND_TESTS | Build tests with valgrind. | ON
* ENABLE_COVERAGE | Build code coverage report from tests. | OFF
* ENABLE_FUZZ_TARGETS | Build target programs suitable for fuzzing with AFL. | OFF
* ENABLE_STATIC | Build static (.a) library | OFF
* BUILD_SHARED_LIBS | Build shared (.so) instead of static (.a) library | ON
* INTERNAL_DOCS | Include developers notes and internal API description into generated Documentation | OFF
*
* Here is the list of available important targets for the `make(1)` tool:
Expand Down

0 comments on commit 703a610

Please sign in to comment.