在我的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中是否存在文件的正确方法是什么?