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")