【发布时间】:2012-10-15 13:35:53
【问题描述】:
在我的 CMake 脚本中,我想查看我的系统上是否有文件,如果有,请使用它执行某些操作,否则使用默认文件执行某些操作。代码如下:
find_file(
${project_name}_${customer}_config
${ROOT}/configuration/${customer}/configuration.${project_name}.xml
)
if(NOT ${${project_name}_${customer}_config} STREQUAL
${project_name}_${customer}_config-NOTFOUND )
configure_file(${ROOT}/configuration/${customer}/configuration.${project_name}.xml
${CMAKE_CURRENT_BINARY_DIR}/conf/configuration.xml)
else()
configure_file(${FAPP_ROOT}/configuration/Default/configuration.${project_name}.xml
${CMAKE_CURRENT_BINARY_DIR}/conf/configuration.xml)
endif()
但似乎,这行不通。
在 CMake 中检查文件是否存在的正确方法是什么?
【问题讨论】:
标签: file cmake file-exists