在CMake 中,PROJECT_SOURCE_DIR和CMAKE_SOURCE_DIR是两个非常重要的变量,它们都指向项目的源代码目录,但在多项目(子项目或多个 CMakeLists.txt 文件)的情况下,它们的值有所不同。 CMAKE_SOURCE_DIR 定义:CMAKE_SOURCE_DIR指向最顶层的 CMakeLists.txt 文件所在的目录,即整个项目的根目录。 用途:这个变量在...
PROJECT_SOURCE_DIR 和 CMAKE_SOURCE_DIR对比在 CMake 中, PROJECT_SOURCE_DIR和CMAKE_SOURCE_DIR是两个非常重要的变量,它们都指向项目的源代码目录,但在多项目(子项目或多个 CMakeLists.txt 文件)的情况下,…
在 CMake 中,PROJECT_SOURCE_DIR和CMAKE_SOURCE_DIR是两个关键变量,都指向项目的源代码目录。然而,在处理多个项目(包括子项目或多个CMakeLists.txt文件)时,这两个变量的值会有所差异。例如,考虑以下项目结构:接着,在项目根目录下执行以下指令:通过终端输出的Message信息,我们可以观察到在整个...
PROJECT_SOURCE_DIR和PROJECT_BINARY_DIR的主要区别在于它们所指的目录不同:前者是源代码目录,后者是构建输出目录。这两个变量在CMake构建过程中各有其用途,共同协作完成项目的构建任务。 同时,这两个变量之间也存在一定的联系。在CMake中,我们可以使用它们来指定源文件、头文件、资源文件等的位置,以及指定构建文件的...
这些变量之间有差异.CMAKE_SOURCE_DIR确实是指定义了顶级CMakeLists.txt的文件夹.但是,PROJECT_SOURCE_DIR是指包含最近的project()命令的CMakeLists.txt的文件夹. 例如,假设你有一个名为Outer的顶级项目,它包含一个子目录,其自己的项目叫做Inner.外面的CMakeLists.txt有: ...
这些变量之间 * 有 * 区别。CMAKE_SOURCE_DIR确实指的是定义顶级CMakeLists.txt的文件夹。但是,...
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include> $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include> PRIVATE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/src/logger> $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/src/logger> ) target_link_libraries(${tgt}...
Issues: Resolves P120917801 Description of changes: CMAKE_SOURCE_DIR points to the top of the CMake source tree, PROJECT_SOURCE_DIR points to the directory of the last project() call. When building AWS-LC by itself the two are the same directory. However
Using CMAKE_SOURCE_DIR here breaks when the maya-usd project is included in another parent project [CMake] Use PROJECT_SOURCE_DIR for nested projects. f300a58 marsupial mentioned this pull request Sep 17, 2020 CMAKE_SOURCE_DIR resolves to wrong directory when included in a parent project ...
What changes were proposed in this pull request? Change PROJECT_SOURCE_DIR to CMAKE_CURRENT_SOURCE_DIR for CMAKE_MODULE_PATH. Why are the changes needed? Line below is not portable when ORC is used by downstream projects: set(CMAKE_MODULE_PATH ${CMAKE_MO