我可以并且应该使用 CMake 进行设置吗

发布于 2024-08-08 12:04:18 字数 438 浏览 1 评论 0原文

我从事的项目按如下方式组织到根文件夹 (VOBS) 中:

|--BUILD_FOLDER
| |-- BUILD_SCRIPTS
| |-- SOME_MORE_CODE
|
|--COMPONENT_A
|--COMPONENT_B

因为它们是 ClearCase VOBS,所以没有更高级别的根文件夹来放置 CMakeLists.txt 此设置似乎不适合 CMake 模式...

  • 是这样吗使用 CMake 的精彩之处?
    • 似乎 CMake 要求所有内容都是分层的,因为它从一个点向下延伸。 .
  • CMake 是适合非 Windows/Linux 目标的工具吗?
    • 这些项目使用自定义 C 编译器并调用第 3 方工具来生成多种格式的应用程序文件。

The projects I work on are organised into root folders (VOBS) as follows:

|--BUILD_FOLDER
| |-- BUILD_SCRIPTS
| |-- SOME_MORE_CODE
|
|--COMPONENT_A
|--COMPONENT_B

Because they are ClearCase VOBS there is no higher level root folder to place a CMakeLists.txt This setup doesn't seem to fit the CMake pattern...

  • Is this a show-stopper to using CMake?
    • It seems that CMake requires everything to be hierarchical as it descends down from one point.
      .
  • Is CMake the right tool for non-windows/Linux targets?
    • The projects use custom c compilers and invoke 3rd party tools to generate application files in several formats.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

嘿咻 2024-08-15 12:04:18

您的组件不必是 CMakeLists.txt 文件所在目录的子目录。将其放置在与组件具有相同级别的文件夹中,并且只需在 ADD_SUBDIRECTORY 命令中使用相对路径:

ADD_SUBDIRECTORY(../componentA)
ADD_SUBDIRECTORY(../componentB)

这就是我建议您安排文件夹的方式。

|--BUILD_FOLDER           <-- this directory is created by "make" (???)
| |-- BUILD_SCRIPTS
| |-- SOME_MORE_CODE
|
|--META_FOLDER  <--- place CMakeLists.txt here
|--COMPONENT_A
|--COMPONENT_B

类似的目录布局用于构建 OpenJDK 6(但当时使用的是常用的 make,而不是 CMake)。

Your components don't have to be subdirectories of the directory you have the CMakeLists.txt file in. Place it in the folder with same rank as of the components and just use relative paths in your ADD_SUBDIRECTORY command:

ADD_SUBDIRECTORY(../componentA)
ADD_SUBDIRECTORY(../componentB)

That's how i suggest you to arrange your folders

|--BUILD_FOLDER           <-- this directory is created by "make" (???)
| |-- BUILD_SCRIPTS
| |-- SOME_MORE_CODE
|
|--META_FOLDER  <--- place CMakeLists.txt here
|--COMPONENT_A
|--COMPONENT_B

Similar directory layout was used to build OpenJDK 6 (but instead of CMake, a usual make was used those days).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文