-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
60 lines (47 loc) · 1.79 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# dbf-tools: CMakeLists.txt
# Copyright (c) 2022 José Miguel (Josemi) Rodríguez M.
# https://github.com/josemirm/dbf-tools
# Clone the repository of libdbf library using Git
cmake_minimum_required(VERSION 3.4)
project(
dbf-tools
VERSION 0.1.0
DESCRIPTION "dbf-tools"
LANGUAGES C
)
set(CMAKE_C_STANDARD 99)
set(CMAKE_C_STANDARD_REQUIRED TRUE)
set(CMAKE_BUILD_TYPE Debug)
# Clone the repository of libdbf
include(AddGitSubmodule.cmake)
add_git_submodule("libdbf")
# Configure libdbf library. This is only valid for Unix-like systems
execute_process(COMMAND /bin/bash "./autogen.sh"
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/libdbf
COMMAND_ERROR_IS_FATAL ANY)
execute_process(COMMAND /bin/bash "./configure"
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/libdbf
COMMAND_ERROR_IS_FATAL ANY)
# Set the source files
set(DBF-INFO-SRC src/dbf-info.c src/utils.c libdbf/src/dbf.c
libdbf/src/dbf_endian.c)
set(DBF-CSV-SRC src/dbf-csv.c src/utils.c libdbf/src/dbf.c
libdbf/src/dbf_endian.c)
# Set include folders
set(INC src libdbf/include/libdbf libdbf/src libdbf)
# Show more warnings and analyze the code looking for common mistakes
# (Uncomment it only for debugging)
# if(CMAKE_C_COMPILER_ID STREQUAL "MSVC")
# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /analyze")
# elseif(CMAKE_C_COMPILER_ID STREQUAL "GNU")
# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -Wall -Wextra -fanalyzer")
# elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra")
# endif()
# Configure the output executable files
add_executable(dbf-info ${DBF-INFO-SRC})
target_include_directories(dbf-info PUBLIC ${INC})
target_link_libraries(dbf-info)
add_executable(dbf-csv ${DBF-CSV-SRC})
target_include_directories(dbf-csv PUBLIC ${INC})
target_link_libraries(dbf-csv)