From 508206223bbf6b57e8c66f5c6284331cb0ba0c88 Mon Sep 17 00:00:00 2001 From: Zhi Guan Date: Sat, 16 Dec 2023 10:35:46 +0800 Subject: [PATCH] Update CMakeLists.txt and make demos optional --- CMakeLists.txt | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c4c61879..6cd15a21 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -362,11 +362,6 @@ if (NOT ${CMAKE_SYSTEM_NAME} STREQUAL "iOS") target_link_libraries (${name}test LINK_PUBLIC gmssl) endforeach() - foreach(name ${demos}) - add_executable(${name} demos/src/${name}.c) - target_link_libraries(${name} LINK_PUBLIC gmssl) - endforeach() - install(TARGETS gmssl-bin RUNTIME DESTINATION bin) endif() @@ -383,6 +378,16 @@ if (CMAKE_C_COMPILER_ID MATCHES "MSVC") # target_compile_options(gmssl-bin PRIVATE /wd4996) endif() +# cmake .. -DENABLE_DEMOS=ON +option(ENABLE_DEMOS "Build demos" OFF) +if (ENABLE_DEMOS) + message(STATUS "ENABLE_DEMOS is ON") + foreach(name ${demos}) + add_executable(${name} demos/src/${name}.c) + target_link_libraries(${name} gmssl) + endforeach() +endif() + set(CPACK_PACKAGE_NAME "GmSSL") set(CPACK_PACKAGE_VENDOR "GmSSL develop team")