初始化/推送
This commit is contained in:
16
CMakeLists.txt
Normal file
16
CMakeLists.txt
Normal file
@@ -0,0 +1,16 @@
|
||||
cmake_minimum_required(VERSION 3.29)
|
||||
project(main C)
|
||||
|
||||
set(CMAKE_C_STANDARD 23)
|
||||
|
||||
# 静态链接
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static")
|
||||
|
||||
# 或者使用以下方式(更推荐)
|
||||
add_executable(main main.c)
|
||||
|
||||
if(WIN32)
|
||||
target_link_libraries(main ws2_32)
|
||||
# 静态链接所有库
|
||||
target_link_options(main PRIVATE -static)
|
||||
endif()
|
||||
Reference in New Issue
Block a user