十万个为什么 [CMake] Windows MinGW Cmake
vscode 里面配置选项
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()