blisp/tools/blisp/CMakeLists.txt
Berk D. Demir e959756f5a Refactor to address compiler warnings
- Unused function warnings
Move function definitions in include/blisp_util.h to lib/blisp_util.c.
Defining them as static leads to internal linkage, accessible in that
translation unit, hence the warning. Their references are to be handled
in other translation units, so they shouldn't be static.

- Unused function parameters
Use C attribute `[[maybe_unused]]` (introduced in C23) to suppress
unused parameter warnings.

  - `blisp_chip_xxxxx_get_eflash_loader` implementations accept clock type
    but don't use it.

  - `drain` function only has a body under macOS and FreeBSD with
    preprocessor predicates.

- Enable compiler warnings
Now that warnings are address enable them `-Wall -Wextra -Wpedantic` for
the library and the tool targets.

N.B. An equivalent of MSVC should be added to CMakeLists.txt, as these
would only work when using GCC or Clang.
2023-04-30 10:21:34 -07:00

22 lines
848 B
CMake

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")
add_subdirectory(${CMAKE_SOURCE_DIR}/vendor/argtable3 ${CMAKE_CURRENT_BINARY_DIR}/argtable3)
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"
"${CMAKE_SOURCE_DIR}/vendor/argtable3/src")
target_link_libraries(blisp PRIVATE
argtable3
libblisp_static)
target_compile_options(blisp PRIVATE -Wall -Wextra -Wpedantic)
if (WIN32)
target_link_libraries(blisp PRIVATE Setupapi.lib)
elseif (APPLE)
target_link_libraries(blisp PRIVATE "-framework IOKit" "-framework CoreFoundation")
endif ()