Update CMakeLists.txt and make demos optional

This commit is contained in:
Zhi Guan
2023-12-16 10:35:46 +08:00
parent 94fc0aacab
commit 508206223b

View File

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