summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt47
1 files changed, 26 insertions, 21 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4a3b896..bfe3ba0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -3,6 +3,8 @@ cmake_minimum_required(VERSION 3.8...3.31)
project(pom)
option(LIBPOM_CXX "Build C++ library" ON)
+option(LIBPOM_EXAMPLES "Build examples" ON)
+option(LIBPOM_TESTS "Build tests" ON)
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
@@ -19,21 +21,24 @@ add_library(pom-shared SHARED pom.c)
set_target_properties(pom-shared PROPERTIES OUTPUT_NAME pom)
# Tests
-add_executable(tests tests/errors.c tests/location.c tests/parsing.c tests/interpretation.c tests/main.c)
-target_include_directories(tests PRIVATE .)
-target_link_libraries(tests pom)
+if (LIBPOM_TESTS)
+ add_executable(tests tests/errors.c tests/location.c tests/parsing.c tests/interpretation.c tests/main.c)
+ target_include_directories(tests PRIVATE .)
+ target_link_libraries(tests pom)
+endif()
# Examples
-add_executable(example_read_conf examples/read_conf.c)
-target_include_directories(example_read_conf PRIVATE .)
-target_link_libraries(example_read_conf pom)
-add_executable(example_custom_alloc examples/custom_alloc.c)
-target_include_directories(example_custom_alloc PRIVATE .)
-target_link_libraries(example_custom_alloc pom)
-add_executable(example_all_functions examples/all_functions.c)
-target_include_directories(example_all_functions PRIVATE .)
-target_link_libraries(example_all_functions pom)
-
+if (LIBPOM_EXAMPLES)
+ add_executable(example_read_conf examples/read_conf.c)
+ target_include_directories(example_read_conf PRIVATE .)
+ target_link_libraries(example_read_conf pom)
+ add_executable(example_custom_alloc examples/custom_alloc.c)
+ target_include_directories(example_custom_alloc PRIVATE .)
+ target_link_libraries(example_custom_alloc pom)
+ add_executable(example_all_functions examples/all_functions.c)
+ target_include_directories(example_all_functions PRIVATE .)
+ target_link_libraries(example_all_functions pom)
+endif()
# Installation
install(TARGETS pom pom-shared DESTINATION lib)
@@ -51,14 +56,14 @@ if (LIBPOM_CXX)
target_link_libraries(pom++-shared PRIVATE pom-shared)
# C++ Examples
- add_executable(example++_read_conf cpp/examples/read_conf.cpp)
- target_include_directories(example++_read_conf PRIVATE cpp)
- target_link_libraries(example++_read_conf pom++)
-
- # C++ Examples
- add_executable(example++_all_functions cpp/examples/all_functions.cpp)
- target_include_directories(example++_all_functions PRIVATE cpp)
- target_link_libraries(example++_all_functions pom++)
+ if (LIBPOM_EXAMPLES)
+ add_executable(example++_read_conf cpp/examples/read_conf.cpp)
+ target_include_directories(example++_read_conf PRIVATE cpp)
+ target_link_libraries(example++_read_conf pom++)
+ add_executable(example++_all_functions cpp/examples/all_functions.cpp)
+ target_include_directories(example++_all_functions PRIVATE cpp)
+ target_link_libraries(example++_all_functions pom++)
+ endif()
# Installation
install(TARGETS pom++ pom++-shared DESTINATION lib)