Small improvements for building against system lib

Avoid including include dir when building against system lib
(to avoid possible dup when also checked out as submodule).
Refine README description.
This commit is contained in:
Schdro 2023-04-09 17:54:09 +02:00
parent d4df989c61
commit f3ebe141ee
2 changed files with 11 additions and 9 deletions

View File

@ -54,7 +54,7 @@ cmake --build .
```
For building against preinstalled system libraries of the used vendor
libraries (system maintainers), additionally define
libraries (e.g. for use by system maintainers), additionally define
`BLISP_USE_SYSTEM_LIBRARIES`, e.g. using following commands:
```bash
mkdir build && cd build

View File

@ -2,17 +2,19 @@ set(ARGTABLE3_ENABLE_TESTS OFF CACHE BOOL "Enable unit tests")
set(ARGTABLE3_ENABLE_EXAMPLES OFF CACHE BOOL "Enable examples")
#set(ARGTABLE3_REPLACE_GETOPT OFF CACHE BOOL "Replace getopt in the system C library")
if(BLISP_USE_SYSTEM_LIBRARIES)
find_package(Argtable3)
else()
add_subdirectory(${CMAKE_SOURCE_DIR}/vendor/argtable3 ${CMAKE_CURRENT_BINARY_DIR}/argtable3)
endif()
add_executable(blisp src/main.c src/cmd/write.c src/util.c src/common.c src/cmd/iot.c)
target_include_directories(blisp PRIVATE
"${CMAKE_SOURCE_DIR}/include"
if(BLISP_USE_SYSTEM_LIBRARIES)
find_package(Argtable3 REQUIRED)
else()
add_subdirectory(${CMAKE_SOURCE_DIR}/vendor/argtable3 ${CMAKE_CURRENT_BINARY_DIR}/argtable3)
target_include_directories(blisp PRIVATE
"${CMAKE_SOURCE_DIR}/vendor/argtable3/src")
endif()
target_include_directories(blisp PRIVATE
"${CMAKE_SOURCE_DIR}/include")
target_link_libraries(blisp PRIVATE
argtable3