【发布时间】:2015-08-12 02:40:51
【问题描述】:
CMake 中主要的数据类型是字符串,CMake 中几乎所有的变量都是基于字符串的。我想知道是否可以创建类似于 C/C++ 结构的结构。我举以下例子来说明我的问题:
使用 C/C++ ,我们可以这样定义结构:
struct targetProperty
{
std::string folder_name;
std::string lib_name;
std::string exe_name;
std::string lib_type;
};
在 CMake 中,我们可以使用 LIST 来模拟这种结构:
set(targetProperty "the location for the folder")
list(APPEND targetProperty "the name of the lib")
list(APPEND targetProperty "the name of the executable")
list(APPEND targetProperty "the type of the lib")
但它不像 C/C++ 中的struct targetProperty 那样清晰,我想知道是否还有其他聪明的选择。谢谢。
【问题讨论】:
标签: cmake