diff options
author | pommicket <pommicket@gmail.com> | 2025-09-16 21:49:54 -0400 |
---|---|---|
committer | pommicket <pommicket@gmail.com> | 2025-09-16 21:49:54 -0400 |
commit | 966eaa9bf1c3120d3ac55c99f89025a37fdb87a0 (patch) | |
tree | c33ad0179d792a434ae3353d7b1bf5d0c687bb90 /CMakeLists.txt | |
parent | 49000be20eb598db55c24a1e982a3b6b0b581eeb (diff) |
Better READMEs
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 47 |
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) |