这是我的 CMakeLists.txt 文件
cmake_minimum_required (VERSION 3.10)
project (hello DESCRIPTION "HELLO WORLD" VERSION 20.05.05)
option (TARGET_ONE "Build for Target One" OFF)
set (CMAKE_CXX_STANDARD 14)
set (CMAKE_CXX_STANDARD_REQUIRED ON)
set (CMAKE_POSITION_INDEPENDENT_CODE ON)
if (TARGET_ONE)
add_definitions (-DTARGETONE)
endif()
add_subdirectory (source)
编辑:这是我正在使用的命令:
cd ~/build
CMAKE_FLAGS="CXX -DTARGET_ONE=ON -DCMAKE_BUILD_TYPE=Release" cmake .
~/build cmake --build .