Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想知道如何在我的 CMakeLists.txt 中设置以下 Visual Studio 构建选项。
Struct Member Alignment = 1 Byte (/Zp1),在项目属性(配置属性 -> C/C++ -> 代码生成)中设置。
您可以将此特定于 MSVC 的编译标志 ( /Zp) 设置为 CMake编译选项:
/Zp
add_library(MyLib SHARED ${MY_SOURCES}) if(MSVC) # Add the /Zp flag for the MyLib library target. target_compile_options(MyLib PRIVATE /Zp1) endif()