搜索 cmake generator
在settings.json里面添加
"cmake.preferredGenerators": [ "MinGW Makefiles" ]
cmake_minimum_required(VERSION 3.0.0)
project(idatalink VERSION 0.1.0)
if (CMAKE_BUILD_TYPE STREQUAL "Release")
set(CMAKE_C_FLAGS "-Wall -Os -s -std=gnu11 -m32")
set(CMAKE_CXX_FLAGS "-Wall -Os -s -std=gnu++11 -m32")
elseif(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(CMAKE_C_FLAGS "-Wall -g -std=gnu11 -m32")
set(CMAKE_CXX_FLAGS "-Wall -g -std=gnu++11 -m32")
endif()
include_directories(
src/dev
)
add_executable(${PROJECT_NAME}
src/dev/dev.cpp
src/idatalink/idatalink.cpp
)
if (CMAKE_BUILD_TYPE STREQUAL "Release")
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND strip "$<TARGET_FILE:${PROJECT_NAME}>"
COMMENT "Strip debug symbols done on final binary."
)
endif()
标签:std,set,CMAKE,十万个,Windows,m32,FLAGS,BUILD,Cmake From: https://www.cnblogs.com/kehuadong/p/18347211