-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
35 lines (26 loc) · 1.09 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
cmake_minimum_required (VERSION 2.8.7)
project (SimpleArgumentParser C CXX)
set (SimpleArgumentParser_VERSION_MAJOR 1)
set (SimpleArgumentParser_VERSION_MINOR 0)
set (SimpleArgumentParser_VERSION_PATCH 6)
option(WITH_TESTS "Compile with test cases." "OFF")
option(SHARED "Compile shared/static library." "OFF")
IF (SHARED)
add_library(sap SHARED "${CMAKE_SOURCE_DIR}/src/sap.c" "${CMAKE_SOURCE_DIR}/src/sap.h")
ELSE()
add_library(sap STATIC "${CMAKE_SOURCE_DIR}/src/sap.c" "${CMAKE_SOURCE_DIR}/src/sap.h")
ENDIF()
set(CMAKE_C_FLAGS "--std=gnu99" ${CMAKE_C_FLAGS})
option(WITH-TESTS "Compile the test application." OFF)
include_directories(${PROJECT_SOURCE_DIR}/src)
add_executable(example-01
${CMAKE_SOURCE_DIR}/examples/example_01.c
${CMAKE_SOURCE_DIR}/src/sap.c
${CMAKE_SOURCE_DIR}/src/sap.h)
IF(WITH_TESTS)
include(ExternalProject)
include(thirdparty/googletest.cmake)
add_subdirectory(${PROJECT_SOURCE_DIR}/tests)
endif()
install (TARGETS sap DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
install (FILES ${PROJECT_SOURCE_DIR}/src/sap.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include)